azure_mgmt_compute 0.21.1 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (307) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-06-15/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  3. data/lib/2016-03-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  4. data/lib/2016-04-30-preview/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  5. data/lib/2017-03-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  6. data/lib/2017-09-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  7. data/lib/2017-12-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  8. data/lib/2018-04-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  9. data/lib/2018-06-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  10. data/lib/2018-09-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  11. data/lib/2018-10-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  12. data/lib/2019-03-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  13. data/lib/2019-04-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  14. data/lib/2019-07-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  15. data/lib/2019-11-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  16. data/lib/2019-12-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  17. data/lib/2019-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_managed_disk_parameters.rb +3 -2
  18. data/lib/2020-06-01/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  19. data/lib/2020-06-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  20. data/lib/2020-09-30-preview/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  21. data/lib/2020-09-30/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  22. data/lib/2020-10-01-preview/generated/azure_mgmt_compute/compute_management_client.rb +1 -1
  23. data/lib/2020-12-01/generated/azure_mgmt_compute.rb +305 -0
  24. data/lib/2020-12-01/generated/azure_mgmt_compute/availability_sets.rb +920 -0
  25. data/lib/2020-12-01/generated/azure_mgmt_compute/compute_management_client.rb +221 -0
  26. data/lib/2020-12-01/generated/azure_mgmt_compute/dedicated_host_groups.rb +861 -0
  27. data/lib/2020-12-01/generated/azure_mgmt_compute/dedicated_hosts.rb +806 -0
  28. data/lib/2020-12-01/generated/azure_mgmt_compute/images.rb +975 -0
  29. data/lib/2020-12-01/generated/azure_mgmt_compute/log_analytics.rb +341 -0
  30. data/lib/2020-12-01/generated/azure_mgmt_compute/models/additional_capabilities.rb +51 -0
  31. data/lib/2020-12-01/generated/azure_mgmt_compute/models/additional_unattend_content.rb +93 -0
  32. data/lib/2020-12-01/generated/azure_mgmt_compute/models/api_entity_reference.rb +47 -0
  33. data/lib/2020-12-01/generated/azure_mgmt_compute/models/api_error.rb +100 -0
  34. data/lib/2020-12-01/generated/azure_mgmt_compute/models/api_error_base.rb +68 -0
  35. data/lib/2020-12-01/generated/azure_mgmt_compute/models/automatic_osupgrade_policy.rb +63 -0
  36. data/lib/2020-12-01/generated/azure_mgmt_compute/models/automatic_osupgrade_properties.rb +47 -0
  37. data/lib/2020-12-01/generated/azure_mgmt_compute/models/automatic_repairs_policy.rb +64 -0
  38. data/lib/2020-12-01/generated/azure_mgmt_compute/models/availability_set.rb +189 -0
  39. data/lib/2020-12-01/generated/azure_mgmt_compute/models/availability_set_list_result.rb +100 -0
  40. data/lib/2020-12-01/generated/azure_mgmt_compute/models/availability_set_sku_types.rb +16 -0
  41. data/lib/2020-12-01/generated/azure_mgmt_compute/models/availability_set_update.rb +142 -0
  42. data/lib/2020-12-01/generated/azure_mgmt_compute/models/available_patch_summary.rb +143 -0
  43. data/lib/2020-12-01/generated/azure_mgmt_compute/models/billing_profile.rb +60 -0
  44. data/lib/2020-12-01/generated/azure_mgmt_compute/models/boot_diagnostics.rb +63 -0
  45. data/lib/2020-12-01/generated/azure_mgmt_compute/models/boot_diagnostics_instance_view.rb +78 -0
  46. data/lib/2020-12-01/generated/azure_mgmt_compute/models/caching_types.rb +17 -0
  47. data/lib/2020-12-01/generated/azure_mgmt_compute/models/component_names.rb +15 -0
  48. data/lib/2020-12-01/generated/azure_mgmt_compute/models/compute_operation_list_result.rb +56 -0
  49. data/lib/2020-12-01/generated/azure_mgmt_compute/models/compute_operation_value.rb +108 -0
  50. data/lib/2020-12-01/generated/azure_mgmt_compute/models/data_disk.rb +224 -0
  51. data/lib/2020-12-01/generated/azure_mgmt_compute/models/data_disk_image.rb +49 -0
  52. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host.rb +219 -0
  53. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_allocatable_vm.rb +60 -0
  54. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_available_capacity.rb +57 -0
  55. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_group.rb +178 -0
  56. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_group_instance_view.rb +57 -0
  57. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_group_list_result.rb +100 -0
  58. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_group_update.rb +141 -0
  59. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_instance_view.rb +81 -0
  60. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_instance_view_with_name.rb +84 -0
  61. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_license_types.rb +17 -0
  62. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_list_result.rb +100 -0
  63. data/lib/2020-12-01/generated/azure_mgmt_compute/models/dedicated_host_update.rb +171 -0
  64. data/lib/2020-12-01/generated/azure_mgmt_compute/models/diagnostics_profile.rb +52 -0
  65. data/lib/2020-12-01/generated/azure_mgmt_compute/models/diff_disk_options.rb +15 -0
  66. data/lib/2020-12-01/generated/azure_mgmt_compute/models/diff_disk_placement.rb +16 -0
  67. data/lib/2020-12-01/generated/azure_mgmt_compute/models/diff_disk_settings.rb +69 -0
  68. data/lib/2020-12-01/generated/azure_mgmt_compute/models/disallowed_configuration.rb +47 -0
  69. data/lib/2020-12-01/generated/azure_mgmt_compute/models/disk_create_option_types.rb +17 -0
  70. data/lib/2020-12-01/generated/azure_mgmt_compute/models/disk_detach_option_types.rb +15 -0
  71. data/lib/2020-12-01/generated/azure_mgmt_compute/models/disk_encryption_set_parameters.rb +46 -0
  72. data/lib/2020-12-01/generated/azure_mgmt_compute/models/disk_encryption_settings.rb +73 -0
  73. data/lib/2020-12-01/generated/azure_mgmt_compute/models/disk_instance_view.rb +87 -0
  74. data/lib/2020-12-01/generated/azure_mgmt_compute/models/execution_state.rb +21 -0
  75. data/lib/2020-12-01/generated/azure_mgmt_compute/models/extended_location.rb +58 -0
  76. data/lib/2020-12-01/generated/azure_mgmt_compute/models/extended_location_types.rb +15 -0
  77. data/lib/2020-12-01/generated/azure_mgmt_compute/models/hardware_profile.rb +106 -0
  78. data/lib/2020-12-01/generated/azure_mgmt_compute/models/hyper_vgeneration_type.rb +16 -0
  79. data/lib/2020-12-01/generated/azure_mgmt_compute/models/hyper_vgeneration_types.rb +16 -0
  80. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image.rb +151 -0
  81. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image_data_disk.rb +108 -0
  82. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image_disk.rb +126 -0
  83. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image_list_result.rb +99 -0
  84. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image_osdisk.rb +123 -0
  85. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image_reference.rb +114 -0
  86. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image_storage_profile.rb +86 -0
  87. data/lib/2020-12-01/generated/azure_mgmt_compute/models/image_update.rb +102 -0
  88. data/lib/2020-12-01/generated/azure_mgmt_compute/models/inner_error.rb +57 -0
  89. data/lib/2020-12-01/generated/azure_mgmt_compute/models/instance_view_status.rb +93 -0
  90. data/lib/2020-12-01/generated/azure_mgmt_compute/models/instance_view_types.rb +15 -0
  91. data/lib/2020-12-01/generated/azure_mgmt_compute/models/interval_in_mins.rb +18 -0
  92. data/lib/2020-12-01/generated/azure_mgmt_compute/models/ipversion.rb +16 -0
  93. data/lib/2020-12-01/generated/azure_mgmt_compute/models/key_vault_key_reference.rb +59 -0
  94. data/lib/2020-12-01/generated/azure_mgmt_compute/models/key_vault_secret_reference.rb +59 -0
  95. data/lib/2020-12-01/generated/azure_mgmt_compute/models/last_patch_installation_summary.rb +179 -0
  96. data/lib/2020-12-01/generated/azure_mgmt_compute/models/linux_configuration.rb +94 -0
  97. data/lib/2020-12-01/generated/azure_mgmt_compute/models/linux_parameters.rb +107 -0
  98. data/lib/2020-12-01/generated/azure_mgmt_compute/models/linux_patch_settings.rb +52 -0
  99. data/lib/2020-12-01/generated/azure_mgmt_compute/models/linux_vmguest_patch_mode.rb +16 -0
  100. data/lib/2020-12-01/generated/azure_mgmt_compute/models/list_usages_result.rb +100 -0
  101. data/lib/2020-12-01/generated/azure_mgmt_compute/models/log_analytics_input_base.rb +124 -0
  102. data/lib/2020-12-01/generated/azure_mgmt_compute/models/log_analytics_operation_result.rb +48 -0
  103. data/lib/2020-12-01/generated/azure_mgmt_compute/models/log_analytics_output.rb +47 -0
  104. data/lib/2020-12-01/generated/azure_mgmt_compute/models/maintenance_operation_result_code_types.rb +18 -0
  105. data/lib/2020-12-01/generated/azure_mgmt_compute/models/maintenance_redeploy_status.rb +115 -0
  106. data/lib/2020-12-01/generated/azure_mgmt_compute/models/managed_disk_parameters.rb +70 -0
  107. data/lib/2020-12-01/generated/azure_mgmt_compute/models/network_interface_reference.rb +55 -0
  108. data/lib/2020-12-01/generated/azure_mgmt_compute/models/network_profile.rb +57 -0
  109. data/lib/2020-12-01/generated/azure_mgmt_compute/models/operating_system_state_types.rb +16 -0
  110. data/lib/2020-12-01/generated/azure_mgmt_compute/models/operating_system_types.rb +16 -0
  111. data/lib/2020-12-01/generated/azure_mgmt_compute/models/orchestration_mode.rb +16 -0
  112. data/lib/2020-12-01/generated/azure_mgmt_compute/models/orchestration_service_names.rb +16 -0
  113. data/lib/2020-12-01/generated/azure_mgmt_compute/models/orchestration_service_state.rb +17 -0
  114. data/lib/2020-12-01/generated/azure_mgmt_compute/models/orchestration_service_state_action.rb +16 -0
  115. data/lib/2020-12-01/generated/azure_mgmt_compute/models/orchestration_service_state_input.rb +59 -0
  116. data/lib/2020-12-01/generated/azure_mgmt_compute/models/orchestration_service_summary.rb +61 -0
  117. data/lib/2020-12-01/generated/azure_mgmt_compute/models/osdisk.rb +191 -0
  118. data/lib/2020-12-01/generated/azure_mgmt_compute/models/osdisk_image.rb +48 -0
  119. data/lib/2020-12-01/generated/azure_mgmt_compute/models/osprofile.rb +204 -0
  120. data/lib/2020-12-01/generated/azure_mgmt_compute/models/pass_names.rb +15 -0
  121. data/lib/2020-12-01/generated/azure_mgmt_compute/models/patch_assessment_state.rb +16 -0
  122. data/lib/2020-12-01/generated/azure_mgmt_compute/models/patch_installation_detail.rb +121 -0
  123. data/lib/2020-12-01/generated/azure_mgmt_compute/models/patch_installation_state.rb +20 -0
  124. data/lib/2020-12-01/generated/azure_mgmt_compute/models/patch_operation_status.rb +19 -0
  125. data/lib/2020-12-01/generated/azure_mgmt_compute/models/patch_settings.rb +71 -0
  126. data/lib/2020-12-01/generated/azure_mgmt_compute/models/plan.rb +86 -0
  127. data/lib/2020-12-01/generated/azure_mgmt_compute/models/protocol_types.rb +16 -0
  128. data/lib/2020-12-01/generated/azure_mgmt_compute/models/proximity_placement_group.rb +180 -0
  129. data/lib/2020-12-01/generated/azure_mgmt_compute/models/proximity_placement_group_list_result.rb +100 -0
  130. data/lib/2020-12-01/generated/azure_mgmt_compute/models/proximity_placement_group_type.rb +16 -0
  131. data/lib/2020-12-01/generated/azure_mgmt_compute/models/proximity_placement_group_update.rb +51 -0
  132. data/lib/2020-12-01/generated/azure_mgmt_compute/models/purchase_plan.rb +71 -0
  133. data/lib/2020-12-01/generated/azure_mgmt_compute/models/recovery_walk_response.rb +60 -0
  134. data/lib/2020-12-01/generated/azure_mgmt_compute/models/request_rate_by_interval_input.rb +113 -0
  135. data/lib/2020-12-01/generated/azure_mgmt_compute/models/resource.rb +110 -0
  136. data/lib/2020-12-01/generated/azure_mgmt_compute/models/resource_identity_type.rb +18 -0
  137. data/lib/2020-12-01/generated/azure_mgmt_compute/models/retrieve_boot_diagnostics_data_result.rb +59 -0
  138. data/lib/2020-12-01/generated/azure_mgmt_compute/models/rollback_status_info.rb +74 -0
  139. data/lib/2020-12-01/generated/azure_mgmt_compute/models/rolling_upgrade_action_type.rb +16 -0
  140. data/lib/2020-12-01/generated/azure_mgmt_compute/models/rolling_upgrade_policy.rb +133 -0
  141. data/lib/2020-12-01/generated/azure_mgmt_compute/models/rolling_upgrade_progress_info.rb +88 -0
  142. data/lib/2020-12-01/generated/azure_mgmt_compute/models/rolling_upgrade_running_status.rb +88 -0
  143. data/lib/2020-12-01/generated/azure_mgmt_compute/models/rolling_upgrade_status_code.rb +18 -0
  144. data/lib/2020-12-01/generated/azure_mgmt_compute/models/rolling_upgrade_status_info.rb +141 -0
  145. data/lib/2020-12-01/generated/azure_mgmt_compute/models/run_command_document.rb +116 -0
  146. data/lib/2020-12-01/generated/azure_mgmt_compute/models/run_command_document_base.rb +92 -0
  147. data/lib/2020-12-01/generated/azure_mgmt_compute/models/run_command_input.rb +87 -0
  148. data/lib/2020-12-01/generated/azure_mgmt_compute/models/run_command_input_parameter.rb +57 -0
  149. data/lib/2020-12-01/generated/azure_mgmt_compute/models/run_command_list_result.rb +100 -0
  150. data/lib/2020-12-01/generated/azure_mgmt_compute/models/run_command_parameter_definition.rb +81 -0
  151. data/lib/2020-12-01/generated/azure_mgmt_compute/models/run_command_result.rb +56 -0
  152. data/lib/2020-12-01/generated/azure_mgmt_compute/models/scale_in_policy.rb +71 -0
  153. data/lib/2020-12-01/generated/azure_mgmt_compute/models/scheduled_events_profile.rb +49 -0
  154. data/lib/2020-12-01/generated/azure_mgmt_compute/models/security_profile.rb +81 -0
  155. data/lib/2020-12-01/generated/azure_mgmt_compute/models/security_types.rb +15 -0
  156. data/lib/2020-12-01/generated/azure_mgmt_compute/models/setting_names.rb +16 -0
  157. data/lib/2020-12-01/generated/azure_mgmt_compute/models/sku.rb +73 -0
  158. data/lib/2020-12-01/generated/azure_mgmt_compute/models/ssh_configuration.rb +56 -0
  159. data/lib/2020-12-01/generated/azure_mgmt_compute/models/ssh_public_key.rb +64 -0
  160. data/lib/2020-12-01/generated/azure_mgmt_compute/models/ssh_public_key_generate_key_pair_result.rb +73 -0
  161. data/lib/2020-12-01/generated/azure_mgmt_compute/models/ssh_public_key_resource.rb +102 -0
  162. data/lib/2020-12-01/generated/azure_mgmt_compute/models/ssh_public_key_update_resource.rb +67 -0
  163. data/lib/2020-12-01/generated/azure_mgmt_compute/models/ssh_public_keys_group_list_result.rb +100 -0
  164. data/lib/2020-12-01/generated/azure_mgmt_compute/models/status_level_types.rb +17 -0
  165. data/lib/2020-12-01/generated/azure_mgmt_compute/models/storage_account_types.rb +18 -0
  166. data/lib/2020-12-01/generated/azure_mgmt_compute/models/storage_profile.rb +89 -0
  167. data/lib/2020-12-01/generated/azure_mgmt_compute/models/sub_resource.rb +47 -0
  168. data/lib/2020-12-01/generated/azure_mgmt_compute/models/sub_resource_read_only.rb +48 -0
  169. data/lib/2020-12-01/generated/azure_mgmt_compute/models/sub_resource_with_colocation_status.rb +57 -0
  170. data/lib/2020-12-01/generated/azure_mgmt_compute/models/terminate_notification_profile.rb +62 -0
  171. data/lib/2020-12-01/generated/azure_mgmt_compute/models/throttled_requests_input.rb +99 -0
  172. data/lib/2020-12-01/generated/azure_mgmt_compute/models/uefi_settings.rb +60 -0
  173. data/lib/2020-12-01/generated/azure_mgmt_compute/models/update_resource.rb +54 -0
  174. data/lib/2020-12-01/generated/azure_mgmt_compute/models/upgrade_mode.rb +17 -0
  175. data/lib/2020-12-01/generated/azure_mgmt_compute/models/upgrade_operation_historical_status_info.rb +73 -0
  176. data/lib/2020-12-01/generated/azure_mgmt_compute/models/upgrade_operation_historical_status_info_properties.rb +116 -0
  177. data/lib/2020-12-01/generated/azure_mgmt_compute/models/upgrade_operation_history_status.rb +74 -0
  178. data/lib/2020-12-01/generated/azure_mgmt_compute/models/upgrade_operation_invoker.rb +17 -0
  179. data/lib/2020-12-01/generated/azure_mgmt_compute/models/upgrade_policy.rb +79 -0
  180. data/lib/2020-12-01/generated/azure_mgmt_compute/models/upgrade_state.rb +18 -0
  181. data/lib/2020-12-01/generated/azure_mgmt_compute/models/usage.rb +83 -0
  182. data/lib/2020-12-01/generated/azure_mgmt_compute/models/usage_name.rb +57 -0
  183. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vault_certificate.rb +72 -0
  184. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vault_secret_group.rb +69 -0
  185. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_hard_disk.rb +46 -0
  186. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine.rb +488 -0
  187. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_agent_instance_view.rb +87 -0
  188. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_assess_patches_result.rb +152 -0
  189. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_capture_parameters.rb +69 -0
  190. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_capture_result.rb +99 -0
  191. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_eviction_policy_types.rb +16 -0
  192. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_extension.rb +208 -0
  193. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_extension_handler_instance_view.rb +71 -0
  194. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_extension_image.rb +146 -0
  195. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_extension_instance_view.rb +109 -0
  196. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_extension_update.rb +147 -0
  197. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_extensions_list_result.rb +55 -0
  198. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_health_status.rb +48 -0
  199. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_identity.rb +102 -0
  200. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_identity_user_assigned_identities_value.rb +61 -0
  201. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_image.rb +184 -0
  202. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_image_feature.rb +57 -0
  203. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_image_resource.rb +100 -0
  204. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_install_patches_parameters.rb +87 -0
  205. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_install_patches_result.rb +204 -0
  206. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_instance_view.rb +258 -0
  207. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_list_result.rb +99 -0
  208. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_patch_status.rb +83 -0
  209. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_priority_types.rb +17 -0
  210. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_reimage_parameters.rb +49 -0
  211. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_run_command.rb +241 -0
  212. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_run_command_instance_view.rb +135 -0
  213. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_run_command_script_source.rb +68 -0
  214. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_run_command_update.rb +206 -0
  215. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_run_commands_list_result.rb +98 -0
  216. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set.rb +358 -0
  217. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_data_disk.rb +153 -0
  218. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension.rb +197 -0
  219. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension_list_result.rb +103 -0
  220. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension_profile.rb +70 -0
  221. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_extension_update.rb +198 -0
  222. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_identity.rb +105 -0
  223. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_identity_user_assigned_identities_value.rb +61 -0
  224. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view.rb +113 -0
  225. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view_statuses_summary.rb +59 -0
  226. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_ip_tag.rb +58 -0
  227. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration.rb +195 -0
  228. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_osupgrade_history.rb +104 -0
  229. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_result.rb +100 -0
  230. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_skus_result.rb +101 -0
  231. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_list_with_link_result.rb +102 -0
  232. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_managed_disk_parameters.rb +63 -0
  233. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration.rb +149 -0
  234. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration_dns_settings.rb +56 -0
  235. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_network_profile.rb +71 -0
  236. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +180 -0
  237. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_osprofile.rb +167 -0
  238. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_public_ipaddress_configuration.rb +120 -0
  239. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_public_ipaddress_configuration_dns_settings.rb +51 -0
  240. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_reimage_parameters.rb +65 -0
  241. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_scale_in_rules.rb +17 -0
  242. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_sku.rb +74 -0
  243. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_sku_capacity.rb +85 -0
  244. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_sku_scale_type.rb +16 -0
  245. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_storage_profile.rb +91 -0
  246. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update.rb +210 -0
  247. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_ipconfiguration.rb +190 -0
  248. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_network_configuration.rb +148 -0
  249. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_network_profile.rb +72 -0
  250. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_osdisk.rb +122 -0
  251. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_osprofile.rb +92 -0
  252. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_public_ipaddress_configuration.rb +72 -0
  253. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_storage_profile.rb +80 -0
  254. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_update_vmprofile.rb +151 -0
  255. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +398 -0
  256. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmextension.rb +190 -0
  257. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmextension_update.rb +164 -0
  258. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmextensions_list_result.rb +57 -0
  259. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmextensions_summary.rb +70 -0
  260. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_ids.rb +57 -0
  261. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_required_ids.rb +55 -0
  262. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_view.rb +211 -0
  263. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmlist_result.rb +101 -0
  264. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmnetwork_profile_configuration.rb +57 -0
  265. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmprofile.rb +190 -0
  266. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmprotection_policy.rb +60 -0
  267. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_scale_set_vmreimage_parameters.rb +44 -0
  268. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_size.rb +106 -0
  269. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_size_list_result.rb +55 -0
  270. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_size_types.rb +180 -0
  271. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_software_patch_properties.rb +172 -0
  272. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_status_code_count.rb +61 -0
  273. data/lib/2020-12-01/generated/azure_mgmt_compute/models/virtual_machine_update.rb +418 -0
  274. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vm_disk_types.rb +16 -0
  275. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vmguest_patch_classification_linux.rb +17 -0
  276. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vmguest_patch_classification_windows.rb +22 -0
  277. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vmguest_patch_reboot_behavior.rb +18 -0
  278. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vmguest_patch_reboot_setting.rb +17 -0
  279. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vmguest_patch_reboot_status.rb +20 -0
  280. data/lib/2020-12-01/generated/azure_mgmt_compute/models/vmscale_set_convert_to_single_placement_group_input.rb +52 -0
  281. data/lib/2020-12-01/generated/azure_mgmt_compute/models/win_rmconfiguration.rb +56 -0
  282. data/lib/2020-12-01/generated/azure_mgmt_compute/models/win_rmlistener.rb +67 -0
  283. data/lib/2020-12-01/generated/azure_mgmt_compute/models/windows_configuration.rb +127 -0
  284. data/lib/2020-12-01/generated/azure_mgmt_compute/models/windows_parameters.rb +117 -0
  285. data/lib/2020-12-01/generated/azure_mgmt_compute/models/windows_vmguest_patch_mode.rb +17 -0
  286. data/lib/2020-12-01/generated/azure_mgmt_compute/module_definition.rb +9 -0
  287. data/lib/2020-12-01/generated/azure_mgmt_compute/operations.rb +109 -0
  288. data/lib/2020-12-01/generated/azure_mgmt_compute/proximity_placement_groups.rb +846 -0
  289. data/lib/2020-12-01/generated/azure_mgmt_compute/ssh_public_keys.rb +939 -0
  290. data/lib/2020-12-01/generated/azure_mgmt_compute/usage_operations.rb +241 -0
  291. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_extension_images.rb +360 -0
  292. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_extensions.rb +701 -0
  293. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_images.rb +600 -0
  294. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_images_edge_zone.rb +626 -0
  295. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_run_commands.rb +1112 -0
  296. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_extensions.rb +821 -0
  297. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_rolling_upgrades.rb +498 -0
  298. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vmextensions.rb +709 -0
  299. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vmrun_commands.rb +827 -0
  300. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_scale_set_vms.rb +2230 -0
  301. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_scale_sets.rb +3523 -0
  302. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machine_sizes.rb +122 -0
  303. data/lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb +3446 -0
  304. data/lib/azure_mgmt_compute.rb +1 -0
  305. data/lib/profiles/latest/modules/compute_profile_module.rb +1010 -944
  306. data/lib/version.rb +1 -1
  307. metadata +283 -2
@@ -0,0 +1,122 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Compute::Mgmt::V2020_12_01
7
+ #
8
+ # Compute Client
9
+ #
10
+ class VirtualMachineSizes
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the VirtualMachineSizes class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ComputeManagementClient] reference to the ComputeManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # This API is deprecated. Use [Resources
26
+ # Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list)
27
+ #
28
+ # @param location [String] The location upon which virtual-machine-sizes is
29
+ # queried.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [VirtualMachineSizeListResult] operation results.
34
+ #
35
+ def list(location, custom_headers:nil)
36
+ response = list_async(location, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # This API is deprecated. Use [Resources
42
+ # Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list)
43
+ #
44
+ # @param location [String] The location upon which virtual-machine-sizes is
45
+ # queried.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_with_http_info(location, custom_headers:nil)
52
+ list_async(location, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # This API is deprecated. Use [Resources
57
+ # Skus](https://docs.microsoft.com/en-us/rest/api/compute/resourceskus/list)
58
+ #
59
+ # @param location [String] The location upon which virtual-machine-sizes is
60
+ # queried.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_async(location, custom_headers:nil)
67
+ fail ArgumentError, 'location is nil' if location.nil?
68
+ fail ArgumentError, "'location' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !location.nil? && location.match(Regexp.new('^^[-\w\._]+$$')).nil?
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+
72
+
73
+ request_headers = {}
74
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
75
+
76
+ # Set Headers
77
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes'
80
+
81
+ request_url = @base_url || @client.base_url
82
+
83
+ options = {
84
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
85
+ path_params: {'location' => location,'subscriptionId' => @client.subscription_id},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:get, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 200
97
+ error_model = JSON.load(response_content)
98
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
103
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
104
+ # Deserialize Response
105
+ if status_code == 200
106
+ begin
107
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
108
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineSizeListResult.mapper()
109
+ result.body = @client.deserialize(result_mapper, parsed_response)
110
+ rescue Exception => e
111
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
112
+ end
113
+ end
114
+
115
+ result
116
+ end
117
+
118
+ promise.execute
119
+ end
120
+
121
+ end
122
+ end
@@ -0,0 +1,3446 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Compute::Mgmt::V2020_12_01
7
+ #
8
+ # Compute Client
9
+ #
10
+ class VirtualMachines
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the VirtualMachines class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ComputeManagementClient] reference to the ComputeManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets all the virtual machines under the specified subscription for the
26
+ # specified location.
27
+ #
28
+ # @param location [String] The location for which virtual machines under the
29
+ # subscription are queried.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<VirtualMachine>] operation results.
34
+ #
35
+ def list_by_location(location, custom_headers:nil)
36
+ first_page = list_by_location_as_lazy(location, custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Gets all the virtual machines under the specified subscription for the
42
+ # specified location.
43
+ #
44
+ # @param location [String] The location for which virtual machines under the
45
+ # subscription are queried.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_by_location_with_http_info(location, custom_headers:nil)
52
+ list_by_location_async(location, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Gets all the virtual machines under the specified subscription for the
57
+ # specified location.
58
+ #
59
+ # @param location [String] The location for which virtual machines under the
60
+ # subscription are queried.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_by_location_async(location, custom_headers:nil)
67
+ fail ArgumentError, 'location is nil' if location.nil?
68
+ fail ArgumentError, "'location' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !location.nil? && location.match(Regexp.new('^^[-\w\._]+$$')).nil?
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+
72
+
73
+ request_headers = {}
74
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
75
+
76
+ # Set Headers
77
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'
80
+
81
+ request_url = @base_url || @client.base_url
82
+
83
+ options = {
84
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
85
+ path_params: {'location' => location,'subscriptionId' => @client.subscription_id},
86
+ query_params: {'api-version' => @client.api_version},
87
+ headers: request_headers.merge(custom_headers || {}),
88
+ base_url: request_url
89
+ }
90
+ promise = @client.make_request_async(:get, path_template, options)
91
+
92
+ promise = promise.then do |result|
93
+ http_response = result.response
94
+ status_code = http_response.status
95
+ response_content = http_response.body
96
+ unless status_code == 200
97
+ error_model = JSON.load(response_content)
98
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
99
+ end
100
+
101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
102
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
103
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
104
+ # Deserialize Response
105
+ if status_code == 200
106
+ begin
107
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
108
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
109
+ result.body = @client.deserialize(result_mapper, parsed_response)
110
+ rescue Exception => e
111
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
112
+ end
113
+ end
114
+
115
+ result
116
+ end
117
+
118
+ promise.execute
119
+ end
120
+
121
+ #
122
+ # Captures the VM by copying virtual hard disks of the VM and outputs a
123
+ # template that can be used to create similar VMs.
124
+ #
125
+ # @param resource_group_name [String] The name of the resource group.
126
+ # @param vm_name [String] The name of the virtual machine.
127
+ # @param parameters [VirtualMachineCaptureParameters] Parameters supplied to
128
+ # the Capture Virtual Machine operation.
129
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
130
+ # will be added to the HTTP request.
131
+ #
132
+ # @return [VirtualMachineCaptureResult] operation results.
133
+ #
134
+ def capture(resource_group_name, vm_name, parameters, custom_headers:nil)
135
+ response = capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
136
+ response.body unless response.nil?
137
+ end
138
+
139
+ #
140
+ # @param resource_group_name [String] The name of the resource group.
141
+ # @param vm_name [String] The name of the virtual machine.
142
+ # @param parameters [VirtualMachineCaptureParameters] Parameters supplied to
143
+ # the Capture Virtual Machine operation.
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [Concurrent::Promise] promise which provides async access to http
148
+ # response.
149
+ #
150
+ def capture_async(resource_group_name, vm_name, parameters, custom_headers:nil)
151
+ # Send request
152
+ promise = begin_capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers)
153
+
154
+ promise = promise.then do |response|
155
+ # Defining deserialization method.
156
+ deserialize_method = lambda do |parsed_response|
157
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineCaptureResult.mapper()
158
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
159
+ end
160
+
161
+ # Waiting for response.
162
+ @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
163
+ end
164
+
165
+ promise
166
+ end
167
+
168
+ #
169
+ # The operation to create or update a virtual machine. Please note some
170
+ # properties can be set only during virtual machine creation.
171
+ #
172
+ # @param resource_group_name [String] The name of the resource group.
173
+ # @param vm_name [String] The name of the virtual machine.
174
+ # @param parameters [VirtualMachine] Parameters supplied to the Create Virtual
175
+ # Machine operation.
176
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
177
+ # will be added to the HTTP request.
178
+ #
179
+ # @return [VirtualMachine] operation results.
180
+ #
181
+ def create_or_update(resource_group_name, vm_name, parameters, custom_headers:nil)
182
+ response = create_or_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
183
+ response.body unless response.nil?
184
+ end
185
+
186
+ #
187
+ # @param resource_group_name [String] The name of the resource group.
188
+ # @param vm_name [String] The name of the virtual machine.
189
+ # @param parameters [VirtualMachine] Parameters supplied to the Create Virtual
190
+ # Machine operation.
191
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
192
+ # will be added to the HTTP request.
193
+ #
194
+ # @return [Concurrent::Promise] promise which provides async access to http
195
+ # response.
196
+ #
197
+ def create_or_update_async(resource_group_name, vm_name, parameters, custom_headers:nil)
198
+ # Send request
199
+ promise = begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers)
200
+
201
+ promise = promise.then do |response|
202
+ # Defining deserialization method.
203
+ deserialize_method = lambda do |parsed_response|
204
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
205
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
206
+ end
207
+
208
+ # Waiting for response.
209
+ @client.get_long_running_operation_result(response, deserialize_method)
210
+ end
211
+
212
+ promise
213
+ end
214
+
215
+ #
216
+ # The operation to update a virtual machine.
217
+ #
218
+ # @param resource_group_name [String] The name of the resource group.
219
+ # @param vm_name [String] The name of the virtual machine.
220
+ # @param parameters [VirtualMachineUpdate] Parameters supplied to the Update
221
+ # Virtual Machine operation.
222
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
223
+ # will be added to the HTTP request.
224
+ #
225
+ # @return [VirtualMachine] operation results.
226
+ #
227
+ def update(resource_group_name, vm_name, parameters, custom_headers:nil)
228
+ response = update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
229
+ response.body unless response.nil?
230
+ end
231
+
232
+ #
233
+ # @param resource_group_name [String] The name of the resource group.
234
+ # @param vm_name [String] The name of the virtual machine.
235
+ # @param parameters [VirtualMachineUpdate] Parameters supplied to the Update
236
+ # Virtual Machine operation.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ # @return [Concurrent::Promise] promise which provides async access to http
241
+ # response.
242
+ #
243
+ def update_async(resource_group_name, vm_name, parameters, custom_headers:nil)
244
+ # Send request
245
+ promise = begin_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers)
246
+
247
+ promise = promise.then do |response|
248
+ # Defining deserialization method.
249
+ deserialize_method = lambda do |parsed_response|
250
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
251
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
252
+ end
253
+
254
+ # Waiting for response.
255
+ @client.get_long_running_operation_result(response, deserialize_method)
256
+ end
257
+
258
+ promise
259
+ end
260
+
261
+ #
262
+ # The operation to delete a virtual machine.
263
+ #
264
+ # @param resource_group_name [String] The name of the resource group.
265
+ # @param vm_name [String] The name of the virtual machine.
266
+ # @param force_deletion [Boolean] Optional parameter to force delete virtual
267
+ # machines.(Feature in Preview)
268
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
269
+ # will be added to the HTTP request.
270
+ #
271
+ def delete(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
272
+ response = delete_async(resource_group_name, vm_name, force_deletion:force_deletion, custom_headers:custom_headers).value!
273
+ nil
274
+ end
275
+
276
+ #
277
+ # @param resource_group_name [String] The name of the resource group.
278
+ # @param vm_name [String] The name of the virtual machine.
279
+ # @param force_deletion [Boolean] Optional parameter to force delete virtual
280
+ # machines.(Feature in Preview)
281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
282
+ # will be added to the HTTP request.
283
+ #
284
+ # @return [Concurrent::Promise] promise which provides async access to http
285
+ # response.
286
+ #
287
+ def delete_async(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
288
+ # Send request
289
+ promise = begin_delete_async(resource_group_name, vm_name, force_deletion:force_deletion, custom_headers:custom_headers)
290
+
291
+ promise = promise.then do |response|
292
+ # Defining deserialization method.
293
+ deserialize_method = lambda do |parsed_response|
294
+ end
295
+
296
+ # Waiting for response.
297
+ @client.get_long_running_operation_result(response, deserialize_method)
298
+ end
299
+
300
+ promise
301
+ end
302
+
303
+ #
304
+ # Retrieves information about the model view or the instance view of a virtual
305
+ # machine.
306
+ #
307
+ # @param resource_group_name [String] The name of the resource group.
308
+ # @param vm_name [String] The name of the virtual machine.
309
+ # @param expand [InstanceViewTypes] The expand expression to apply on the
310
+ # operation. Possible values include: 'instanceView'
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [VirtualMachine] operation results.
315
+ #
316
+ def get(resource_group_name, vm_name, expand:nil, custom_headers:nil)
317
+ response = get_async(resource_group_name, vm_name, expand:expand, custom_headers:custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Retrieves information about the model view or the instance view of a virtual
323
+ # machine.
324
+ #
325
+ # @param resource_group_name [String] The name of the resource group.
326
+ # @param vm_name [String] The name of the virtual machine.
327
+ # @param expand [InstanceViewTypes] The expand expression to apply on the
328
+ # operation. Possible values include: 'instanceView'
329
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
330
+ # will be added to the HTTP request.
331
+ #
332
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
333
+ #
334
+ def get_with_http_info(resource_group_name, vm_name, expand:nil, custom_headers:nil)
335
+ get_async(resource_group_name, vm_name, expand:expand, custom_headers:custom_headers).value!
336
+ end
337
+
338
+ #
339
+ # Retrieves information about the model view or the instance view of a virtual
340
+ # machine.
341
+ #
342
+ # @param resource_group_name [String] The name of the resource group.
343
+ # @param vm_name [String] The name of the virtual machine.
344
+ # @param expand [InstanceViewTypes] The expand expression to apply on the
345
+ # operation. Possible values include: 'instanceView'
346
+ # @param [Hash{String => String}] A hash of custom headers that will be added
347
+ # to the HTTP request.
348
+ #
349
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
350
+ #
351
+ def get_async(resource_group_name, vm_name, expand:nil, custom_headers:nil)
352
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
353
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
354
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
355
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
356
+
357
+
358
+ request_headers = {}
359
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
360
+
361
+ # Set Headers
362
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
363
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
364
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'
365
+
366
+ request_url = @base_url || @client.base_url
367
+
368
+ options = {
369
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
370
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
371
+ query_params: {'$expand' => expand,'api-version' => @client.api_version},
372
+ headers: request_headers.merge(custom_headers || {}),
373
+ base_url: request_url
374
+ }
375
+ promise = @client.make_request_async(:get, path_template, options)
376
+
377
+ promise = promise.then do |result|
378
+ http_response = result.response
379
+ status_code = http_response.status
380
+ response_content = http_response.body
381
+ unless status_code == 200
382
+ error_model = JSON.load(response_content)
383
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
384
+ end
385
+
386
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
387
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
388
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
389
+ # Deserialize Response
390
+ if status_code == 200
391
+ begin
392
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
393
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
394
+ result.body = @client.deserialize(result_mapper, parsed_response)
395
+ rescue Exception => e
396
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
397
+ end
398
+ end
399
+
400
+ result
401
+ end
402
+
403
+ promise.execute
404
+ end
405
+
406
+ #
407
+ # Retrieves information about the run-time state of a virtual machine.
408
+ #
409
+ # @param resource_group_name [String] The name of the resource group.
410
+ # @param vm_name [String] The name of the virtual machine.
411
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
412
+ # will be added to the HTTP request.
413
+ #
414
+ # @return [VirtualMachineInstanceView] operation results.
415
+ #
416
+ def instance_view(resource_group_name, vm_name, custom_headers:nil)
417
+ response = instance_view_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
418
+ response.body unless response.nil?
419
+ end
420
+
421
+ #
422
+ # Retrieves information about the run-time state of a virtual machine.
423
+ #
424
+ # @param resource_group_name [String] The name of the resource group.
425
+ # @param vm_name [String] The name of the virtual machine.
426
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
427
+ # will be added to the HTTP request.
428
+ #
429
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
430
+ #
431
+ def instance_view_with_http_info(resource_group_name, vm_name, custom_headers:nil)
432
+ instance_view_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
433
+ end
434
+
435
+ #
436
+ # Retrieves information about the run-time state of a virtual machine.
437
+ #
438
+ # @param resource_group_name [String] The name of the resource group.
439
+ # @param vm_name [String] The name of the virtual machine.
440
+ # @param [Hash{String => String}] A hash of custom headers that will be added
441
+ # to the HTTP request.
442
+ #
443
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
444
+ #
445
+ def instance_view_async(resource_group_name, vm_name, custom_headers:nil)
446
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
447
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
448
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
449
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
450
+
451
+
452
+ request_headers = {}
453
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
454
+
455
+ # Set Headers
456
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
457
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
458
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'
459
+
460
+ request_url = @base_url || @client.base_url
461
+
462
+ options = {
463
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
464
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
465
+ query_params: {'api-version' => @client.api_version},
466
+ headers: request_headers.merge(custom_headers || {}),
467
+ base_url: request_url
468
+ }
469
+ promise = @client.make_request_async(:get, path_template, options)
470
+
471
+ promise = promise.then do |result|
472
+ http_response = result.response
473
+ status_code = http_response.status
474
+ response_content = http_response.body
475
+ unless status_code == 200
476
+ error_model = JSON.load(response_content)
477
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
478
+ end
479
+
480
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
481
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
482
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
483
+ # Deserialize Response
484
+ if status_code == 200
485
+ begin
486
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
487
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstanceView.mapper()
488
+ result.body = @client.deserialize(result_mapper, parsed_response)
489
+ rescue Exception => e
490
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
491
+ end
492
+ end
493
+
494
+ result
495
+ end
496
+
497
+ promise.execute
498
+ end
499
+
500
+ #
501
+ # Converts virtual machine disks from blob-based to managed disks. Virtual
502
+ # machine must be stop-deallocated before invoking this operation.
503
+ #
504
+ # @param resource_group_name [String] The name of the resource group.
505
+ # @param vm_name [String] The name of the virtual machine.
506
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
507
+ # will be added to the HTTP request.
508
+ #
509
+ def convert_to_managed_disks(resource_group_name, vm_name, custom_headers:nil)
510
+ response = convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
511
+ nil
512
+ end
513
+
514
+ #
515
+ # @param resource_group_name [String] The name of the resource group.
516
+ # @param vm_name [String] The name of the virtual machine.
517
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
518
+ # will be added to the HTTP request.
519
+ #
520
+ # @return [Concurrent::Promise] promise which provides async access to http
521
+ # response.
522
+ #
523
+ def convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:nil)
524
+ # Send request
525
+ promise = begin_convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:custom_headers)
526
+
527
+ promise = promise.then do |response|
528
+ # Defining deserialization method.
529
+ deserialize_method = lambda do |parsed_response|
530
+ end
531
+
532
+ # Waiting for response.
533
+ @client.get_long_running_operation_result(response, deserialize_method)
534
+ end
535
+
536
+ promise
537
+ end
538
+
539
+ #
540
+ # Shuts down the virtual machine and releases the compute resources. You are
541
+ # not billed for the compute resources that this virtual machine uses.
542
+ #
543
+ # @param resource_group_name [String] The name of the resource group.
544
+ # @param vm_name [String] The name of the virtual machine.
545
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
546
+ # will be added to the HTTP request.
547
+ #
548
+ def deallocate(resource_group_name, vm_name, custom_headers:nil)
549
+ response = deallocate_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
550
+ nil
551
+ end
552
+
553
+ #
554
+ # @param resource_group_name [String] The name of the resource group.
555
+ # @param vm_name [String] The name of the virtual machine.
556
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
557
+ # will be added to the HTTP request.
558
+ #
559
+ # @return [Concurrent::Promise] promise which provides async access to http
560
+ # response.
561
+ #
562
+ def deallocate_async(resource_group_name, vm_name, custom_headers:nil)
563
+ # Send request
564
+ promise = begin_deallocate_async(resource_group_name, vm_name, custom_headers:custom_headers)
565
+
566
+ promise = promise.then do |response|
567
+ # Defining deserialization method.
568
+ deserialize_method = lambda do |parsed_response|
569
+ end
570
+
571
+ # Waiting for response.
572
+ @client.get_long_running_operation_result(response, deserialize_method)
573
+ end
574
+
575
+ promise
576
+ end
577
+
578
+ #
579
+ # Sets the OS state of the virtual machine to generalized. It is recommended to
580
+ # sysprep the virtual machine before performing this operation. <br>For
581
+ # Windows, please refer to [Create a managed image of a generalized VM in
582
+ # Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
583
+ # Linux, please refer to [How to create an image of a virtual machine or
584
+ # VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
585
+ #
586
+ # @param resource_group_name [String] The name of the resource group.
587
+ # @param vm_name [String] The name of the virtual machine.
588
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
589
+ # will be added to the HTTP request.
590
+ #
591
+ #
592
+ def generalize(resource_group_name, vm_name, custom_headers:nil)
593
+ response = generalize_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
594
+ nil
595
+ end
596
+
597
+ #
598
+ # Sets the OS state of the virtual machine to generalized. It is recommended to
599
+ # sysprep the virtual machine before performing this operation. <br>For
600
+ # Windows, please refer to [Create a managed image of a generalized VM in
601
+ # Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
602
+ # Linux, please refer to [How to create an image of a virtual machine or
603
+ # VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
604
+ #
605
+ # @param resource_group_name [String] The name of the resource group.
606
+ # @param vm_name [String] The name of the virtual machine.
607
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
608
+ # will be added to the HTTP request.
609
+ #
610
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
611
+ #
612
+ def generalize_with_http_info(resource_group_name, vm_name, custom_headers:nil)
613
+ generalize_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
614
+ end
615
+
616
+ #
617
+ # Sets the OS state of the virtual machine to generalized. It is recommended to
618
+ # sysprep the virtual machine before performing this operation. <br>For
619
+ # Windows, please refer to [Create a managed image of a generalized VM in
620
+ # Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
621
+ # Linux, please refer to [How to create an image of a virtual machine or
622
+ # VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
623
+ #
624
+ # @param resource_group_name [String] The name of the resource group.
625
+ # @param vm_name [String] The name of the virtual machine.
626
+ # @param [Hash{String => String}] A hash of custom headers that will be added
627
+ # to the HTTP request.
628
+ #
629
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
630
+ #
631
+ def generalize_async(resource_group_name, vm_name, custom_headers:nil)
632
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
633
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
634
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
635
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
636
+
637
+
638
+ request_headers = {}
639
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
640
+
641
+ # Set Headers
642
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
643
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
644
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'
645
+
646
+ request_url = @base_url || @client.base_url
647
+
648
+ options = {
649
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
650
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
651
+ query_params: {'api-version' => @client.api_version},
652
+ headers: request_headers.merge(custom_headers || {}),
653
+ base_url: request_url
654
+ }
655
+ promise = @client.make_request_async(:post, path_template, options)
656
+
657
+ promise = promise.then do |result|
658
+ http_response = result.response
659
+ status_code = http_response.status
660
+ response_content = http_response.body
661
+ unless status_code == 200
662
+ error_model = JSON.load(response_content)
663
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
664
+ end
665
+
666
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
667
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
668
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
669
+
670
+ result
671
+ end
672
+
673
+ promise.execute
674
+ end
675
+
676
+ #
677
+ # Lists all of the virtual machines in the specified resource group. Use the
678
+ # nextLink property in the response to get the next page of virtual machines.
679
+ #
680
+ # @param resource_group_name [String] The name of the resource group.
681
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
682
+ # will be added to the HTTP request.
683
+ #
684
+ # @return [Array<VirtualMachine>] operation results.
685
+ #
686
+ def list(resource_group_name, custom_headers:nil)
687
+ first_page = list_as_lazy(resource_group_name, custom_headers:custom_headers)
688
+ first_page.get_all_items
689
+ end
690
+
691
+ #
692
+ # Lists all of the virtual machines in the specified resource group. Use the
693
+ # nextLink property in the response to get the next page of virtual machines.
694
+ #
695
+ # @param resource_group_name [String] The name of the resource group.
696
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
697
+ # will be added to the HTTP request.
698
+ #
699
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
700
+ #
701
+ def list_with_http_info(resource_group_name, custom_headers:nil)
702
+ list_async(resource_group_name, custom_headers:custom_headers).value!
703
+ end
704
+
705
+ #
706
+ # Lists all of the virtual machines in the specified resource group. Use the
707
+ # nextLink property in the response to get the next page of virtual machines.
708
+ #
709
+ # @param resource_group_name [String] The name of the resource group.
710
+ # @param [Hash{String => String}] A hash of custom headers that will be added
711
+ # to the HTTP request.
712
+ #
713
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
714
+ #
715
+ def list_async(resource_group_name, custom_headers:nil)
716
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
717
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
718
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
719
+
720
+
721
+ request_headers = {}
722
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
723
+
724
+ # Set Headers
725
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
726
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
727
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'
728
+
729
+ request_url = @base_url || @client.base_url
730
+
731
+ options = {
732
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
733
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
734
+ query_params: {'api-version' => @client.api_version},
735
+ headers: request_headers.merge(custom_headers || {}),
736
+ base_url: request_url
737
+ }
738
+ promise = @client.make_request_async(:get, path_template, options)
739
+
740
+ promise = promise.then do |result|
741
+ http_response = result.response
742
+ status_code = http_response.status
743
+ response_content = http_response.body
744
+ unless status_code == 200
745
+ error_model = JSON.load(response_content)
746
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
747
+ end
748
+
749
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
750
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
751
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
752
+ # Deserialize Response
753
+ if status_code == 200
754
+ begin
755
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
756
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
757
+ result.body = @client.deserialize(result_mapper, parsed_response)
758
+ rescue Exception => e
759
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
760
+ end
761
+ end
762
+
763
+ result
764
+ end
765
+
766
+ promise.execute
767
+ end
768
+
769
+ #
770
+ # Lists all of the virtual machines in the specified subscription. Use the
771
+ # nextLink property in the response to get the next page of virtual machines.
772
+ #
773
+ # @param status_only [String] statusOnly=true enables fetching run time status
774
+ # of all Virtual Machines in the subscription.
775
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
776
+ # will be added to the HTTP request.
777
+ #
778
+ # @return [Array<VirtualMachine>] operation results.
779
+ #
780
+ def list_all(status_only:nil, custom_headers:nil)
781
+ first_page = list_all_as_lazy(status_only:status_only, custom_headers:custom_headers)
782
+ first_page.get_all_items
783
+ end
784
+
785
+ #
786
+ # Lists all of the virtual machines in the specified subscription. Use the
787
+ # nextLink property in the response to get the next page of virtual machines.
788
+ #
789
+ # @param status_only [String] statusOnly=true enables fetching run time status
790
+ # of all Virtual Machines in the subscription.
791
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
792
+ # will be added to the HTTP request.
793
+ #
794
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
795
+ #
796
+ def list_all_with_http_info(status_only:nil, custom_headers:nil)
797
+ list_all_async(status_only:status_only, custom_headers:custom_headers).value!
798
+ end
799
+
800
+ #
801
+ # Lists all of the virtual machines in the specified subscription. Use the
802
+ # nextLink property in the response to get the next page of virtual machines.
803
+ #
804
+ # @param status_only [String] statusOnly=true enables fetching run time status
805
+ # of all Virtual Machines in the subscription.
806
+ # @param [Hash{String => String}] A hash of custom headers that will be added
807
+ # to the HTTP request.
808
+ #
809
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
810
+ #
811
+ def list_all_async(status_only:nil, custom_headers:nil)
812
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
813
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
814
+
815
+
816
+ request_headers = {}
817
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
818
+
819
+ # Set Headers
820
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
821
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
822
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'
823
+
824
+ request_url = @base_url || @client.base_url
825
+
826
+ options = {
827
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
828
+ path_params: {'subscriptionId' => @client.subscription_id},
829
+ query_params: {'api-version' => @client.api_version,'statusOnly' => status_only},
830
+ headers: request_headers.merge(custom_headers || {}),
831
+ base_url: request_url
832
+ }
833
+ promise = @client.make_request_async(:get, path_template, options)
834
+
835
+ promise = promise.then do |result|
836
+ http_response = result.response
837
+ status_code = http_response.status
838
+ response_content = http_response.body
839
+ unless status_code == 200
840
+ error_model = JSON.load(response_content)
841
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
842
+ end
843
+
844
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
845
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
846
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
847
+ # Deserialize Response
848
+ if status_code == 200
849
+ begin
850
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
851
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
852
+ result.body = @client.deserialize(result_mapper, parsed_response)
853
+ rescue Exception => e
854
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
855
+ end
856
+ end
857
+
858
+ result
859
+ end
860
+
861
+ promise.execute
862
+ end
863
+
864
+ #
865
+ # Lists all available virtual machine sizes to which the specified virtual
866
+ # machine can be resized.
867
+ #
868
+ # @param resource_group_name [String] The name of the resource group.
869
+ # @param vm_name [String] The name of the virtual machine.
870
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
871
+ # will be added to the HTTP request.
872
+ #
873
+ # @return [VirtualMachineSizeListResult] operation results.
874
+ #
875
+ def list_available_sizes(resource_group_name, vm_name, custom_headers:nil)
876
+ response = list_available_sizes_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
877
+ response.body unless response.nil?
878
+ end
879
+
880
+ #
881
+ # Lists all available virtual machine sizes to which the specified virtual
882
+ # machine can be resized.
883
+ #
884
+ # @param resource_group_name [String] The name of the resource group.
885
+ # @param vm_name [String] The name of the virtual machine.
886
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
887
+ # will be added to the HTTP request.
888
+ #
889
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
890
+ #
891
+ def list_available_sizes_with_http_info(resource_group_name, vm_name, custom_headers:nil)
892
+ list_available_sizes_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
893
+ end
894
+
895
+ #
896
+ # Lists all available virtual machine sizes to which the specified virtual
897
+ # machine can be resized.
898
+ #
899
+ # @param resource_group_name [String] The name of the resource group.
900
+ # @param vm_name [String] The name of the virtual machine.
901
+ # @param [Hash{String => String}] A hash of custom headers that will be added
902
+ # to the HTTP request.
903
+ #
904
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
905
+ #
906
+ def list_available_sizes_async(resource_group_name, vm_name, custom_headers:nil)
907
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
908
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
909
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
910
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
911
+
912
+
913
+ request_headers = {}
914
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
915
+
916
+ # Set Headers
917
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
918
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
919
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes'
920
+
921
+ request_url = @base_url || @client.base_url
922
+
923
+ options = {
924
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
925
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
926
+ query_params: {'api-version' => @client.api_version},
927
+ headers: request_headers.merge(custom_headers || {}),
928
+ base_url: request_url
929
+ }
930
+ promise = @client.make_request_async(:get, path_template, options)
931
+
932
+ promise = promise.then do |result|
933
+ http_response = result.response
934
+ status_code = http_response.status
935
+ response_content = http_response.body
936
+ unless status_code == 200
937
+ error_model = JSON.load(response_content)
938
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
939
+ end
940
+
941
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
942
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
943
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
944
+ # Deserialize Response
945
+ if status_code == 200
946
+ begin
947
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
948
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineSizeListResult.mapper()
949
+ result.body = @client.deserialize(result_mapper, parsed_response)
950
+ rescue Exception => e
951
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
952
+ end
953
+ end
954
+
955
+ result
956
+ end
957
+
958
+ promise.execute
959
+ end
960
+
961
+ #
962
+ # The operation to power off (stop) a virtual machine. The virtual machine can
963
+ # be restarted with the same provisioned resources. You are still charged for
964
+ # this virtual machine.
965
+ #
966
+ # @param resource_group_name [String] The name of the resource group.
967
+ # @param vm_name [String] The name of the virtual machine.
968
+ # @param skip_shutdown [Boolean] The parameter to request non-graceful VM
969
+ # shutdown. True value for this flag indicates non-graceful shutdown whereas
970
+ # false indicates otherwise. Default value for this flag is false if not
971
+ # specified
972
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
973
+ # will be added to the HTTP request.
974
+ #
975
+ def power_off(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
976
+ response = power_off_async(resource_group_name, vm_name, skip_shutdown:skip_shutdown, custom_headers:custom_headers).value!
977
+ nil
978
+ end
979
+
980
+ #
981
+ # @param resource_group_name [String] The name of the resource group.
982
+ # @param vm_name [String] The name of the virtual machine.
983
+ # @param skip_shutdown [Boolean] The parameter to request non-graceful VM
984
+ # shutdown. True value for this flag indicates non-graceful shutdown whereas
985
+ # false indicates otherwise. Default value for this flag is false if not
986
+ # specified
987
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
988
+ # will be added to the HTTP request.
989
+ #
990
+ # @return [Concurrent::Promise] promise which provides async access to http
991
+ # response.
992
+ #
993
+ def power_off_async(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
994
+ # Send request
995
+ promise = begin_power_off_async(resource_group_name, vm_name, skip_shutdown:skip_shutdown, custom_headers:custom_headers)
996
+
997
+ promise = promise.then do |response|
998
+ # Defining deserialization method.
999
+ deserialize_method = lambda do |parsed_response|
1000
+ end
1001
+
1002
+ # Waiting for response.
1003
+ @client.get_long_running_operation_result(response, deserialize_method)
1004
+ end
1005
+
1006
+ promise
1007
+ end
1008
+
1009
+ #
1010
+ # The operation to reapply a virtual machine's state.
1011
+ #
1012
+ # @param resource_group_name [String] The name of the resource group.
1013
+ # @param vm_name [String] The name of the virtual machine.
1014
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1015
+ # will be added to the HTTP request.
1016
+ #
1017
+ def reapply(resource_group_name, vm_name, custom_headers:nil)
1018
+ response = reapply_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1019
+ nil
1020
+ end
1021
+
1022
+ #
1023
+ # @param resource_group_name [String] The name of the resource group.
1024
+ # @param vm_name [String] The name of the virtual machine.
1025
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1026
+ # will be added to the HTTP request.
1027
+ #
1028
+ # @return [Concurrent::Promise] promise which provides async access to http
1029
+ # response.
1030
+ #
1031
+ def reapply_async(resource_group_name, vm_name, custom_headers:nil)
1032
+ # Send request
1033
+ promise = begin_reapply_async(resource_group_name, vm_name, custom_headers:custom_headers)
1034
+
1035
+ promise = promise.then do |response|
1036
+ # Defining deserialization method.
1037
+ deserialize_method = lambda do |parsed_response|
1038
+ end
1039
+
1040
+ # Waiting for response.
1041
+ @client.get_long_running_operation_result(response, deserialize_method)
1042
+ end
1043
+
1044
+ promise
1045
+ end
1046
+
1047
+ #
1048
+ # The operation to restart a virtual machine.
1049
+ #
1050
+ # @param resource_group_name [String] The name of the resource group.
1051
+ # @param vm_name [String] The name of the virtual machine.
1052
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1053
+ # will be added to the HTTP request.
1054
+ #
1055
+ def restart(resource_group_name, vm_name, custom_headers:nil)
1056
+ response = restart_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1057
+ nil
1058
+ end
1059
+
1060
+ #
1061
+ # @param resource_group_name [String] The name of the resource group.
1062
+ # @param vm_name [String] The name of the virtual machine.
1063
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1064
+ # will be added to the HTTP request.
1065
+ #
1066
+ # @return [Concurrent::Promise] promise which provides async access to http
1067
+ # response.
1068
+ #
1069
+ def restart_async(resource_group_name, vm_name, custom_headers:nil)
1070
+ # Send request
1071
+ promise = begin_restart_async(resource_group_name, vm_name, custom_headers:custom_headers)
1072
+
1073
+ promise = promise.then do |response|
1074
+ # Defining deserialization method.
1075
+ deserialize_method = lambda do |parsed_response|
1076
+ end
1077
+
1078
+ # Waiting for response.
1079
+ @client.get_long_running_operation_result(response, deserialize_method)
1080
+ end
1081
+
1082
+ promise
1083
+ end
1084
+
1085
+ #
1086
+ # The operation to start a virtual machine.
1087
+ #
1088
+ # @param resource_group_name [String] The name of the resource group.
1089
+ # @param vm_name [String] The name of the virtual machine.
1090
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1091
+ # will be added to the HTTP request.
1092
+ #
1093
+ def start(resource_group_name, vm_name, custom_headers:nil)
1094
+ response = start_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1095
+ nil
1096
+ end
1097
+
1098
+ #
1099
+ # @param resource_group_name [String] The name of the resource group.
1100
+ # @param vm_name [String] The name of the virtual machine.
1101
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1102
+ # will be added to the HTTP request.
1103
+ #
1104
+ # @return [Concurrent::Promise] promise which provides async access to http
1105
+ # response.
1106
+ #
1107
+ def start_async(resource_group_name, vm_name, custom_headers:nil)
1108
+ # Send request
1109
+ promise = begin_start_async(resource_group_name, vm_name, custom_headers:custom_headers)
1110
+
1111
+ promise = promise.then do |response|
1112
+ # Defining deserialization method.
1113
+ deserialize_method = lambda do |parsed_response|
1114
+ end
1115
+
1116
+ # Waiting for response.
1117
+ @client.get_long_running_operation_result(response, deserialize_method)
1118
+ end
1119
+
1120
+ promise
1121
+ end
1122
+
1123
+ #
1124
+ # Shuts down the virtual machine, moves it to a new node, and powers it back
1125
+ # on.
1126
+ #
1127
+ # @param resource_group_name [String] The name of the resource group.
1128
+ # @param vm_name [String] The name of the virtual machine.
1129
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1130
+ # will be added to the HTTP request.
1131
+ #
1132
+ def redeploy(resource_group_name, vm_name, custom_headers:nil)
1133
+ response = redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1134
+ nil
1135
+ end
1136
+
1137
+ #
1138
+ # @param resource_group_name [String] The name of the resource group.
1139
+ # @param vm_name [String] The name of the virtual machine.
1140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1141
+ # will be added to the HTTP request.
1142
+ #
1143
+ # @return [Concurrent::Promise] promise which provides async access to http
1144
+ # response.
1145
+ #
1146
+ def redeploy_async(resource_group_name, vm_name, custom_headers:nil)
1147
+ # Send request
1148
+ promise = begin_redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers)
1149
+
1150
+ promise = promise.then do |response|
1151
+ # Defining deserialization method.
1152
+ deserialize_method = lambda do |parsed_response|
1153
+ end
1154
+
1155
+ # Waiting for response.
1156
+ @client.get_long_running_operation_result(response, deserialize_method)
1157
+ end
1158
+
1159
+ promise
1160
+ end
1161
+
1162
+ #
1163
+ # Reimages the virtual machine which has an ephemeral OS disk back to its
1164
+ # initial state.
1165
+ #
1166
+ # @param resource_group_name [String] The name of the resource group.
1167
+ # @param vm_name [String] The name of the virtual machine.
1168
+ # @param parameters [VirtualMachineReimageParameters] Parameters supplied to
1169
+ # the Reimage Virtual Machine operation.
1170
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1171
+ # will be added to the HTTP request.
1172
+ #
1173
+ def reimage(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
1174
+ response = reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers:custom_headers).value!
1175
+ nil
1176
+ end
1177
+
1178
+ #
1179
+ # @param resource_group_name [String] The name of the resource group.
1180
+ # @param vm_name [String] The name of the virtual machine.
1181
+ # @param parameters [VirtualMachineReimageParameters] Parameters supplied to
1182
+ # the Reimage Virtual Machine operation.
1183
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1184
+ # will be added to the HTTP request.
1185
+ #
1186
+ # @return [Concurrent::Promise] promise which provides async access to http
1187
+ # response.
1188
+ #
1189
+ def reimage_async(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
1190
+ # Send request
1191
+ promise = begin_reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers:custom_headers)
1192
+
1193
+ promise = promise.then do |response|
1194
+ # Defining deserialization method.
1195
+ deserialize_method = lambda do |parsed_response|
1196
+ end
1197
+
1198
+ # Waiting for response.
1199
+ @client.get_long_running_operation_result(response, deserialize_method)
1200
+ end
1201
+
1202
+ promise
1203
+ end
1204
+
1205
+ #
1206
+ # The operation to retrieve SAS URIs for a virtual machine's boot diagnostic
1207
+ # logs.
1208
+ #
1209
+ # @param resource_group_name [String] The name of the resource group.
1210
+ # @param vm_name [String] The name of the virtual machine.
1211
+ # @param sas_uri_expiration_time_in_minutes [Integer] Expiration duration in
1212
+ # minutes for the SAS URIs with a value between 1 to 1440 minutes.
1213
+ # <br><br>NOTE: If not specified, SAS URIs will be generated with a default
1214
+ # expiration duration of 120 minutes.
1215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1216
+ # will be added to the HTTP request.
1217
+ #
1218
+ # @return [RetrieveBootDiagnosticsDataResult] operation results.
1219
+ #
1220
+ def retrieve_boot_diagnostics_data(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:nil, custom_headers:nil)
1221
+ response = retrieve_boot_diagnostics_data_async(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:sas_uri_expiration_time_in_minutes, custom_headers:custom_headers).value!
1222
+ response.body unless response.nil?
1223
+ end
1224
+
1225
+ #
1226
+ # The operation to retrieve SAS URIs for a virtual machine's boot diagnostic
1227
+ # logs.
1228
+ #
1229
+ # @param resource_group_name [String] The name of the resource group.
1230
+ # @param vm_name [String] The name of the virtual machine.
1231
+ # @param sas_uri_expiration_time_in_minutes [Integer] Expiration duration in
1232
+ # minutes for the SAS URIs with a value between 1 to 1440 minutes.
1233
+ # <br><br>NOTE: If not specified, SAS URIs will be generated with a default
1234
+ # expiration duration of 120 minutes.
1235
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1236
+ # will be added to the HTTP request.
1237
+ #
1238
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1239
+ #
1240
+ def retrieve_boot_diagnostics_data_with_http_info(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:nil, custom_headers:nil)
1241
+ retrieve_boot_diagnostics_data_async(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:sas_uri_expiration_time_in_minutes, custom_headers:custom_headers).value!
1242
+ end
1243
+
1244
+ #
1245
+ # The operation to retrieve SAS URIs for a virtual machine's boot diagnostic
1246
+ # logs.
1247
+ #
1248
+ # @param resource_group_name [String] The name of the resource group.
1249
+ # @param vm_name [String] The name of the virtual machine.
1250
+ # @param sas_uri_expiration_time_in_minutes [Integer] Expiration duration in
1251
+ # minutes for the SAS URIs with a value between 1 to 1440 minutes.
1252
+ # <br><br>NOTE: If not specified, SAS URIs will be generated with a default
1253
+ # expiration duration of 120 minutes.
1254
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1255
+ # to the HTTP request.
1256
+ #
1257
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1258
+ #
1259
+ def retrieve_boot_diagnostics_data_async(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:nil, custom_headers:nil)
1260
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1261
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
1262
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1263
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1264
+
1265
+
1266
+ request_headers = {}
1267
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1268
+
1269
+ # Set Headers
1270
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1271
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1272
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'
1273
+
1274
+ request_url = @base_url || @client.base_url
1275
+
1276
+ options = {
1277
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1278
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
1279
+ query_params: {'sasUriExpirationTimeInMinutes' => sas_uri_expiration_time_in_minutes,'api-version' => @client.api_version},
1280
+ headers: request_headers.merge(custom_headers || {}),
1281
+ base_url: request_url
1282
+ }
1283
+ promise = @client.make_request_async(:post, path_template, options)
1284
+
1285
+ promise = promise.then do |result|
1286
+ http_response = result.response
1287
+ status_code = http_response.status
1288
+ response_content = http_response.body
1289
+ unless status_code == 200
1290
+ error_model = JSON.load(response_content)
1291
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1292
+ end
1293
+
1294
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1295
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1296
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1297
+ # Deserialize Response
1298
+ if status_code == 200
1299
+ begin
1300
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1301
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RetrieveBootDiagnosticsDataResult.mapper()
1302
+ result.body = @client.deserialize(result_mapper, parsed_response)
1303
+ rescue Exception => e
1304
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1305
+ end
1306
+ end
1307
+
1308
+ result
1309
+ end
1310
+
1311
+ promise.execute
1312
+ end
1313
+
1314
+ #
1315
+ # The operation to perform maintenance on a virtual machine.
1316
+ #
1317
+ # @param resource_group_name [String] The name of the resource group.
1318
+ # @param vm_name [String] The name of the virtual machine.
1319
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1320
+ # will be added to the HTTP request.
1321
+ #
1322
+ def perform_maintenance(resource_group_name, vm_name, custom_headers:nil)
1323
+ response = perform_maintenance_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1324
+ nil
1325
+ end
1326
+
1327
+ #
1328
+ # @param resource_group_name [String] The name of the resource group.
1329
+ # @param vm_name [String] The name of the virtual machine.
1330
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1331
+ # will be added to the HTTP request.
1332
+ #
1333
+ # @return [Concurrent::Promise] promise which provides async access to http
1334
+ # response.
1335
+ #
1336
+ def perform_maintenance_async(resource_group_name, vm_name, custom_headers:nil)
1337
+ # Send request
1338
+ promise = begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers:custom_headers)
1339
+
1340
+ promise = promise.then do |response|
1341
+ # Defining deserialization method.
1342
+ deserialize_method = lambda do |parsed_response|
1343
+ end
1344
+
1345
+ # Waiting for response.
1346
+ @client.get_long_running_operation_result(response, deserialize_method)
1347
+ end
1348
+
1349
+ promise
1350
+ end
1351
+
1352
+ #
1353
+ # The operation to simulate the eviction of spot virtual machine.
1354
+ #
1355
+ # @param resource_group_name [String] The name of the resource group.
1356
+ # @param vm_name [String] The name of the virtual machine.
1357
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1358
+ # will be added to the HTTP request.
1359
+ #
1360
+ #
1361
+ def simulate_eviction(resource_group_name, vm_name, custom_headers:nil)
1362
+ response = simulate_eviction_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1363
+ nil
1364
+ end
1365
+
1366
+ #
1367
+ # The operation to simulate the eviction of spot virtual machine.
1368
+ #
1369
+ # @param resource_group_name [String] The name of the resource group.
1370
+ # @param vm_name [String] The name of the virtual machine.
1371
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1372
+ # will be added to the HTTP request.
1373
+ #
1374
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1375
+ #
1376
+ def simulate_eviction_with_http_info(resource_group_name, vm_name, custom_headers:nil)
1377
+ simulate_eviction_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1378
+ end
1379
+
1380
+ #
1381
+ # The operation to simulate the eviction of spot virtual machine.
1382
+ #
1383
+ # @param resource_group_name [String] The name of the resource group.
1384
+ # @param vm_name [String] The name of the virtual machine.
1385
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1386
+ # to the HTTP request.
1387
+ #
1388
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1389
+ #
1390
+ def simulate_eviction_async(resource_group_name, vm_name, custom_headers:nil)
1391
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1392
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
1393
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1394
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1395
+
1396
+
1397
+ request_headers = {}
1398
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1399
+
1400
+ # Set Headers
1401
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1402
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1403
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction'
1404
+
1405
+ request_url = @base_url || @client.base_url
1406
+
1407
+ options = {
1408
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1409
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
1410
+ query_params: {'api-version' => @client.api_version},
1411
+ headers: request_headers.merge(custom_headers || {}),
1412
+ base_url: request_url
1413
+ }
1414
+ promise = @client.make_request_async(:post, path_template, options)
1415
+
1416
+ promise = promise.then do |result|
1417
+ http_response = result.response
1418
+ status_code = http_response.status
1419
+ response_content = http_response.body
1420
+ unless status_code == 204
1421
+ error_model = JSON.load(response_content)
1422
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1423
+ end
1424
+
1425
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1426
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1427
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1428
+
1429
+ result
1430
+ end
1431
+
1432
+ promise.execute
1433
+ end
1434
+
1435
+ #
1436
+ # Assess patches on the VM.
1437
+ #
1438
+ # @param resource_group_name [String] The name of the resource group.
1439
+ # @param vm_name [String] The name of the virtual machine.
1440
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1441
+ # will be added to the HTTP request.
1442
+ #
1443
+ # @return [VirtualMachineAssessPatchesResult] operation results.
1444
+ #
1445
+ def assess_patches(resource_group_name, vm_name, custom_headers:nil)
1446
+ response = assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
1447
+ response.body unless response.nil?
1448
+ end
1449
+
1450
+ #
1451
+ # @param resource_group_name [String] The name of the resource group.
1452
+ # @param vm_name [String] The name of the virtual machine.
1453
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1454
+ # will be added to the HTTP request.
1455
+ #
1456
+ # @return [Concurrent::Promise] promise which provides async access to http
1457
+ # response.
1458
+ #
1459
+ def assess_patches_async(resource_group_name, vm_name, custom_headers:nil)
1460
+ # Send request
1461
+ promise = begin_assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers)
1462
+
1463
+ promise = promise.then do |response|
1464
+ # Defining deserialization method.
1465
+ deserialize_method = lambda do |parsed_response|
1466
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineAssessPatchesResult.mapper()
1467
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1468
+ end
1469
+
1470
+ # Waiting for response.
1471
+ @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
1472
+ end
1473
+
1474
+ promise
1475
+ end
1476
+
1477
+ #
1478
+ # Installs patches on the VM.
1479
+ #
1480
+ # @param resource_group_name [String] The name of the resource group.
1481
+ # @param vm_name [String] The name of the virtual machine.
1482
+ # @param install_patches_input [VirtualMachineInstallPatchesParameters] Input
1483
+ # for InstallPatches as directly received by the API
1484
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1485
+ # will be added to the HTTP request.
1486
+ #
1487
+ # @return [VirtualMachineInstallPatchesResult] operation results.
1488
+ #
1489
+ def install_patches(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
1490
+ response = install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers).value!
1491
+ response.body unless response.nil?
1492
+ end
1493
+
1494
+ #
1495
+ # @param resource_group_name [String] The name of the resource group.
1496
+ # @param vm_name [String] The name of the virtual machine.
1497
+ # @param install_patches_input [VirtualMachineInstallPatchesParameters] Input
1498
+ # for InstallPatches as directly received by the API
1499
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1500
+ # will be added to the HTTP request.
1501
+ #
1502
+ # @return [Concurrent::Promise] promise which provides async access to http
1503
+ # response.
1504
+ #
1505
+ def install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
1506
+ # Send request
1507
+ promise = begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers)
1508
+
1509
+ promise = promise.then do |response|
1510
+ # Defining deserialization method.
1511
+ deserialize_method = lambda do |parsed_response|
1512
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstallPatchesResult.mapper()
1513
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1514
+ end
1515
+
1516
+ # Waiting for response.
1517
+ @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
1518
+ end
1519
+
1520
+ promise
1521
+ end
1522
+
1523
+ #
1524
+ # Run command on the VM.
1525
+ #
1526
+ # @param resource_group_name [String] The name of the resource group.
1527
+ # @param vm_name [String] The name of the virtual machine.
1528
+ # @param parameters [RunCommandInput] Parameters supplied to the Run command
1529
+ # operation.
1530
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1531
+ # will be added to the HTTP request.
1532
+ #
1533
+ # @return [RunCommandResult] operation results.
1534
+ #
1535
+ def run_command(resource_group_name, vm_name, parameters, custom_headers:nil)
1536
+ response = run_command_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
1537
+ response.body unless response.nil?
1538
+ end
1539
+
1540
+ #
1541
+ # @param resource_group_name [String] The name of the resource group.
1542
+ # @param vm_name [String] The name of the virtual machine.
1543
+ # @param parameters [RunCommandInput] Parameters supplied to the Run command
1544
+ # operation.
1545
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1546
+ # will be added to the HTTP request.
1547
+ #
1548
+ # @return [Concurrent::Promise] promise which provides async access to http
1549
+ # response.
1550
+ #
1551
+ def run_command_async(resource_group_name, vm_name, parameters, custom_headers:nil)
1552
+ # Send request
1553
+ promise = begin_run_command_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers)
1554
+
1555
+ promise = promise.then do |response|
1556
+ # Defining deserialization method.
1557
+ deserialize_method = lambda do |parsed_response|
1558
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RunCommandResult.mapper()
1559
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1560
+ end
1561
+
1562
+ # Waiting for response.
1563
+ @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
1564
+ end
1565
+
1566
+ promise
1567
+ end
1568
+
1569
+ #
1570
+ # Captures the VM by copying virtual hard disks of the VM and outputs a
1571
+ # template that can be used to create similar VMs.
1572
+ #
1573
+ # @param resource_group_name [String] The name of the resource group.
1574
+ # @param vm_name [String] The name of the virtual machine.
1575
+ # @param parameters [VirtualMachineCaptureParameters] Parameters supplied to
1576
+ # the Capture Virtual Machine operation.
1577
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1578
+ # will be added to the HTTP request.
1579
+ #
1580
+ # @return [VirtualMachineCaptureResult] operation results.
1581
+ #
1582
+ def begin_capture(resource_group_name, vm_name, parameters, custom_headers:nil)
1583
+ response = begin_capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
1584
+ response.body unless response.nil?
1585
+ end
1586
+
1587
+ #
1588
+ # Captures the VM by copying virtual hard disks of the VM and outputs a
1589
+ # template that can be used to create similar VMs.
1590
+ #
1591
+ # @param resource_group_name [String] The name of the resource group.
1592
+ # @param vm_name [String] The name of the virtual machine.
1593
+ # @param parameters [VirtualMachineCaptureParameters] Parameters supplied to
1594
+ # the Capture Virtual Machine operation.
1595
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1596
+ # will be added to the HTTP request.
1597
+ #
1598
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1599
+ #
1600
+ def begin_capture_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
1601
+ begin_capture_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
1602
+ end
1603
+
1604
+ #
1605
+ # Captures the VM by copying virtual hard disks of the VM and outputs a
1606
+ # template that can be used to create similar VMs.
1607
+ #
1608
+ # @param resource_group_name [String] The name of the resource group.
1609
+ # @param vm_name [String] The name of the virtual machine.
1610
+ # @param parameters [VirtualMachineCaptureParameters] Parameters supplied to
1611
+ # the Capture Virtual Machine operation.
1612
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1613
+ # to the HTTP request.
1614
+ #
1615
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1616
+ #
1617
+ def begin_capture_async(resource_group_name, vm_name, parameters, custom_headers:nil)
1618
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1619
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
1620
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1621
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1622
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1623
+
1624
+
1625
+ request_headers = {}
1626
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1627
+
1628
+ # Set Headers
1629
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1630
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1631
+
1632
+ # Serialize Request
1633
+ request_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineCaptureParameters.mapper()
1634
+ request_content = @client.serialize(request_mapper, parameters)
1635
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1636
+
1637
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'
1638
+
1639
+ request_url = @base_url || @client.base_url
1640
+
1641
+ options = {
1642
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1643
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
1644
+ query_params: {'api-version' => @client.api_version},
1645
+ body: request_content,
1646
+ headers: request_headers.merge(custom_headers || {}),
1647
+ base_url: request_url
1648
+ }
1649
+ promise = @client.make_request_async(:post, path_template, options)
1650
+
1651
+ promise = promise.then do |result|
1652
+ http_response = result.response
1653
+ status_code = http_response.status
1654
+ response_content = http_response.body
1655
+ unless status_code == 200 || status_code == 202
1656
+ error_model = JSON.load(response_content)
1657
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1658
+ end
1659
+
1660
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1661
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1662
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1663
+ # Deserialize Response
1664
+ if status_code == 200
1665
+ begin
1666
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1667
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineCaptureResult.mapper()
1668
+ result.body = @client.deserialize(result_mapper, parsed_response)
1669
+ rescue Exception => e
1670
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1671
+ end
1672
+ end
1673
+
1674
+ result
1675
+ end
1676
+
1677
+ promise.execute
1678
+ end
1679
+
1680
+ #
1681
+ # The operation to create or update a virtual machine. Please note some
1682
+ # properties can be set only during virtual machine creation.
1683
+ #
1684
+ # @param resource_group_name [String] The name of the resource group.
1685
+ # @param vm_name [String] The name of the virtual machine.
1686
+ # @param parameters [VirtualMachine] Parameters supplied to the Create Virtual
1687
+ # Machine operation.
1688
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1689
+ # will be added to the HTTP request.
1690
+ #
1691
+ # @return [VirtualMachine] operation results.
1692
+ #
1693
+ def begin_create_or_update(resource_group_name, vm_name, parameters, custom_headers:nil)
1694
+ response = begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
1695
+ response.body unless response.nil?
1696
+ end
1697
+
1698
+ #
1699
+ # The operation to create or update a virtual machine. Please note some
1700
+ # properties can be set only during virtual machine creation.
1701
+ #
1702
+ # @param resource_group_name [String] The name of the resource group.
1703
+ # @param vm_name [String] The name of the virtual machine.
1704
+ # @param parameters [VirtualMachine] Parameters supplied to the Create Virtual
1705
+ # Machine operation.
1706
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1707
+ # will be added to the HTTP request.
1708
+ #
1709
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1710
+ #
1711
+ def begin_create_or_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
1712
+ begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
1713
+ end
1714
+
1715
+ #
1716
+ # The operation to create or update a virtual machine. Please note some
1717
+ # properties can be set only during virtual machine creation.
1718
+ #
1719
+ # @param resource_group_name [String] The name of the resource group.
1720
+ # @param vm_name [String] The name of the virtual machine.
1721
+ # @param parameters [VirtualMachine] Parameters supplied to the Create Virtual
1722
+ # Machine operation.
1723
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1724
+ # to the HTTP request.
1725
+ #
1726
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1727
+ #
1728
+ def begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers:nil)
1729
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1730
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
1731
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1732
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1733
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1734
+
1735
+
1736
+ request_headers = {}
1737
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1738
+
1739
+ # Set Headers
1740
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1741
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1742
+
1743
+ # Serialize Request
1744
+ request_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
1745
+ request_content = @client.serialize(request_mapper, parameters)
1746
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1747
+
1748
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'
1749
+
1750
+ request_url = @base_url || @client.base_url
1751
+
1752
+ options = {
1753
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1754
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
1755
+ query_params: {'api-version' => @client.api_version},
1756
+ body: request_content,
1757
+ headers: request_headers.merge(custom_headers || {}),
1758
+ base_url: request_url
1759
+ }
1760
+ promise = @client.make_request_async(:put, path_template, options)
1761
+
1762
+ promise = promise.then do |result|
1763
+ http_response = result.response
1764
+ status_code = http_response.status
1765
+ response_content = http_response.body
1766
+ unless status_code == 200 || status_code == 201
1767
+ error_model = JSON.load(response_content)
1768
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1769
+ end
1770
+
1771
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1772
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1773
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1774
+ # Deserialize Response
1775
+ if status_code == 200
1776
+ begin
1777
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1778
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
1779
+ result.body = @client.deserialize(result_mapper, parsed_response)
1780
+ rescue Exception => e
1781
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1782
+ end
1783
+ end
1784
+ # Deserialize Response
1785
+ if status_code == 201
1786
+ begin
1787
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1788
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
1789
+ result.body = @client.deserialize(result_mapper, parsed_response)
1790
+ rescue Exception => e
1791
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1792
+ end
1793
+ end
1794
+
1795
+ result
1796
+ end
1797
+
1798
+ promise.execute
1799
+ end
1800
+
1801
+ #
1802
+ # The operation to update a virtual machine.
1803
+ #
1804
+ # @param resource_group_name [String] The name of the resource group.
1805
+ # @param vm_name [String] The name of the virtual machine.
1806
+ # @param parameters [VirtualMachineUpdate] Parameters supplied to the Update
1807
+ # Virtual Machine operation.
1808
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1809
+ # will be added to the HTTP request.
1810
+ #
1811
+ # @return [VirtualMachine] operation results.
1812
+ #
1813
+ def begin_update(resource_group_name, vm_name, parameters, custom_headers:nil)
1814
+ response = begin_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
1815
+ response.body unless response.nil?
1816
+ end
1817
+
1818
+ #
1819
+ # The operation to update a virtual machine.
1820
+ #
1821
+ # @param resource_group_name [String] The name of the resource group.
1822
+ # @param vm_name [String] The name of the virtual machine.
1823
+ # @param parameters [VirtualMachineUpdate] Parameters supplied to the Update
1824
+ # Virtual Machine operation.
1825
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1826
+ # will be added to the HTTP request.
1827
+ #
1828
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1829
+ #
1830
+ def begin_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
1831
+ begin_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
1832
+ end
1833
+
1834
+ #
1835
+ # The operation to update a virtual machine.
1836
+ #
1837
+ # @param resource_group_name [String] The name of the resource group.
1838
+ # @param vm_name [String] The name of the virtual machine.
1839
+ # @param parameters [VirtualMachineUpdate] Parameters supplied to the Update
1840
+ # Virtual Machine operation.
1841
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1842
+ # to the HTTP request.
1843
+ #
1844
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1845
+ #
1846
+ def begin_update_async(resource_group_name, vm_name, parameters, custom_headers:nil)
1847
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1848
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
1849
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1850
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1851
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1852
+
1853
+
1854
+ request_headers = {}
1855
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1856
+
1857
+ # Set Headers
1858
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1859
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1860
+
1861
+ # Serialize Request
1862
+ request_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineUpdate.mapper()
1863
+ request_content = @client.serialize(request_mapper, parameters)
1864
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1865
+
1866
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'
1867
+
1868
+ request_url = @base_url || @client.base_url
1869
+
1870
+ options = {
1871
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1872
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
1873
+ query_params: {'api-version' => @client.api_version},
1874
+ body: request_content,
1875
+ headers: request_headers.merge(custom_headers || {}),
1876
+ base_url: request_url
1877
+ }
1878
+ promise = @client.make_request_async(:patch, path_template, options)
1879
+
1880
+ promise = promise.then do |result|
1881
+ http_response = result.response
1882
+ status_code = http_response.status
1883
+ response_content = http_response.body
1884
+ unless status_code == 200
1885
+ error_model = JSON.load(response_content)
1886
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1887
+ end
1888
+
1889
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1890
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1891
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1892
+ # Deserialize Response
1893
+ if status_code == 200
1894
+ begin
1895
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1896
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
1897
+ result.body = @client.deserialize(result_mapper, parsed_response)
1898
+ rescue Exception => e
1899
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1900
+ end
1901
+ end
1902
+
1903
+ result
1904
+ end
1905
+
1906
+ promise.execute
1907
+ end
1908
+
1909
+ #
1910
+ # The operation to delete a virtual machine.
1911
+ #
1912
+ # @param resource_group_name [String] The name of the resource group.
1913
+ # @param vm_name [String] The name of the virtual machine.
1914
+ # @param force_deletion [Boolean] Optional parameter to force delete virtual
1915
+ # machines.(Feature in Preview)
1916
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1917
+ # will be added to the HTTP request.
1918
+ #
1919
+ #
1920
+ def begin_delete(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
1921
+ response = begin_delete_async(resource_group_name, vm_name, force_deletion:force_deletion, custom_headers:custom_headers).value!
1922
+ nil
1923
+ end
1924
+
1925
+ #
1926
+ # The operation to delete a virtual machine.
1927
+ #
1928
+ # @param resource_group_name [String] The name of the resource group.
1929
+ # @param vm_name [String] The name of the virtual machine.
1930
+ # @param force_deletion [Boolean] Optional parameter to force delete virtual
1931
+ # machines.(Feature in Preview)
1932
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1933
+ # will be added to the HTTP request.
1934
+ #
1935
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1936
+ #
1937
+ def begin_delete_with_http_info(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
1938
+ begin_delete_async(resource_group_name, vm_name, force_deletion:force_deletion, custom_headers:custom_headers).value!
1939
+ end
1940
+
1941
+ #
1942
+ # The operation to delete a virtual machine.
1943
+ #
1944
+ # @param resource_group_name [String] The name of the resource group.
1945
+ # @param vm_name [String] The name of the virtual machine.
1946
+ # @param force_deletion [Boolean] Optional parameter to force delete virtual
1947
+ # machines.(Feature in Preview)
1948
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1949
+ # to the HTTP request.
1950
+ #
1951
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1952
+ #
1953
+ def begin_delete_async(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
1954
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1955
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
1956
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1957
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1958
+
1959
+
1960
+ request_headers = {}
1961
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1962
+
1963
+ # Set Headers
1964
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1965
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1966
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'
1967
+
1968
+ request_url = @base_url || @client.base_url
1969
+
1970
+ options = {
1971
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1972
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
1973
+ query_params: {'forceDeletion' => force_deletion,'api-version' => @client.api_version},
1974
+ headers: request_headers.merge(custom_headers || {}),
1975
+ base_url: request_url
1976
+ }
1977
+ promise = @client.make_request_async(:delete, path_template, options)
1978
+
1979
+ promise = promise.then do |result|
1980
+ http_response = result.response
1981
+ status_code = http_response.status
1982
+ response_content = http_response.body
1983
+ unless status_code == 200 || status_code == 202 || status_code == 204
1984
+ error_model = JSON.load(response_content)
1985
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1986
+ end
1987
+
1988
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1989
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1990
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1991
+
1992
+ result
1993
+ end
1994
+
1995
+ promise.execute
1996
+ end
1997
+
1998
+ #
1999
+ # Converts virtual machine disks from blob-based to managed disks. Virtual
2000
+ # machine must be stop-deallocated before invoking this operation.
2001
+ #
2002
+ # @param resource_group_name [String] The name of the resource group.
2003
+ # @param vm_name [String] The name of the virtual machine.
2004
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2005
+ # will be added to the HTTP request.
2006
+ #
2007
+ #
2008
+ def begin_convert_to_managed_disks(resource_group_name, vm_name, custom_headers:nil)
2009
+ response = begin_convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2010
+ nil
2011
+ end
2012
+
2013
+ #
2014
+ # Converts virtual machine disks from blob-based to managed disks. Virtual
2015
+ # machine must be stop-deallocated before invoking this operation.
2016
+ #
2017
+ # @param resource_group_name [String] The name of the resource group.
2018
+ # @param vm_name [String] The name of the virtual machine.
2019
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2020
+ # will be added to the HTTP request.
2021
+ #
2022
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2023
+ #
2024
+ def begin_convert_to_managed_disks_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2025
+ begin_convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2026
+ end
2027
+
2028
+ #
2029
+ # Converts virtual machine disks from blob-based to managed disks. Virtual
2030
+ # machine must be stop-deallocated before invoking this operation.
2031
+ #
2032
+ # @param resource_group_name [String] The name of the resource group.
2033
+ # @param vm_name [String] The name of the virtual machine.
2034
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2035
+ # to the HTTP request.
2036
+ #
2037
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2038
+ #
2039
+ def begin_convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:nil)
2040
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2041
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2042
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2043
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2044
+
2045
+
2046
+ request_headers = {}
2047
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2048
+
2049
+ # Set Headers
2050
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2051
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2052
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'
2053
+
2054
+ request_url = @base_url || @client.base_url
2055
+
2056
+ options = {
2057
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2058
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2059
+ query_params: {'api-version' => @client.api_version},
2060
+ headers: request_headers.merge(custom_headers || {}),
2061
+ base_url: request_url
2062
+ }
2063
+ promise = @client.make_request_async(:post, path_template, options)
2064
+
2065
+ promise = promise.then do |result|
2066
+ http_response = result.response
2067
+ status_code = http_response.status
2068
+ response_content = http_response.body
2069
+ unless status_code == 200 || status_code == 202
2070
+ error_model = JSON.load(response_content)
2071
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2072
+ end
2073
+
2074
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2075
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2076
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2077
+
2078
+ result
2079
+ end
2080
+
2081
+ promise.execute
2082
+ end
2083
+
2084
+ #
2085
+ # Shuts down the virtual machine and releases the compute resources. You are
2086
+ # not billed for the compute resources that this virtual machine uses.
2087
+ #
2088
+ # @param resource_group_name [String] The name of the resource group.
2089
+ # @param vm_name [String] The name of the virtual machine.
2090
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2091
+ # will be added to the HTTP request.
2092
+ #
2093
+ #
2094
+ def begin_deallocate(resource_group_name, vm_name, custom_headers:nil)
2095
+ response = begin_deallocate_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2096
+ nil
2097
+ end
2098
+
2099
+ #
2100
+ # Shuts down the virtual machine and releases the compute resources. You are
2101
+ # not billed for the compute resources that this virtual machine uses.
2102
+ #
2103
+ # @param resource_group_name [String] The name of the resource group.
2104
+ # @param vm_name [String] The name of the virtual machine.
2105
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2106
+ # will be added to the HTTP request.
2107
+ #
2108
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2109
+ #
2110
+ def begin_deallocate_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2111
+ begin_deallocate_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2112
+ end
2113
+
2114
+ #
2115
+ # Shuts down the virtual machine and releases the compute resources. You are
2116
+ # not billed for the compute resources that this virtual machine uses.
2117
+ #
2118
+ # @param resource_group_name [String] The name of the resource group.
2119
+ # @param vm_name [String] The name of the virtual machine.
2120
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2121
+ # to the HTTP request.
2122
+ #
2123
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2124
+ #
2125
+ def begin_deallocate_async(resource_group_name, vm_name, custom_headers:nil)
2126
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2127
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2128
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2129
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2130
+
2131
+
2132
+ request_headers = {}
2133
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2134
+
2135
+ # Set Headers
2136
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2137
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2138
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'
2139
+
2140
+ request_url = @base_url || @client.base_url
2141
+
2142
+ options = {
2143
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2144
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2145
+ query_params: {'api-version' => @client.api_version},
2146
+ headers: request_headers.merge(custom_headers || {}),
2147
+ base_url: request_url
2148
+ }
2149
+ promise = @client.make_request_async(:post, path_template, options)
2150
+
2151
+ promise = promise.then do |result|
2152
+ http_response = result.response
2153
+ status_code = http_response.status
2154
+ response_content = http_response.body
2155
+ unless status_code == 200 || status_code == 202
2156
+ error_model = JSON.load(response_content)
2157
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2158
+ end
2159
+
2160
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2161
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2162
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2163
+
2164
+ result
2165
+ end
2166
+
2167
+ promise.execute
2168
+ end
2169
+
2170
+ #
2171
+ # The operation to power off (stop) a virtual machine. The virtual machine can
2172
+ # be restarted with the same provisioned resources. You are still charged for
2173
+ # this virtual machine.
2174
+ #
2175
+ # @param resource_group_name [String] The name of the resource group.
2176
+ # @param vm_name [String] The name of the virtual machine.
2177
+ # @param skip_shutdown [Boolean] The parameter to request non-graceful VM
2178
+ # shutdown. True value for this flag indicates non-graceful shutdown whereas
2179
+ # false indicates otherwise. Default value for this flag is false if not
2180
+ # specified
2181
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2182
+ # will be added to the HTTP request.
2183
+ #
2184
+ #
2185
+ def begin_power_off(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
2186
+ response = begin_power_off_async(resource_group_name, vm_name, skip_shutdown:skip_shutdown, custom_headers:custom_headers).value!
2187
+ nil
2188
+ end
2189
+
2190
+ #
2191
+ # The operation to power off (stop) a virtual machine. The virtual machine can
2192
+ # be restarted with the same provisioned resources. You are still charged for
2193
+ # this virtual machine.
2194
+ #
2195
+ # @param resource_group_name [String] The name of the resource group.
2196
+ # @param vm_name [String] The name of the virtual machine.
2197
+ # @param skip_shutdown [Boolean] The parameter to request non-graceful VM
2198
+ # shutdown. True value for this flag indicates non-graceful shutdown whereas
2199
+ # false indicates otherwise. Default value for this flag is false if not
2200
+ # specified
2201
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2202
+ # will be added to the HTTP request.
2203
+ #
2204
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2205
+ #
2206
+ def begin_power_off_with_http_info(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
2207
+ begin_power_off_async(resource_group_name, vm_name, skip_shutdown:skip_shutdown, custom_headers:custom_headers).value!
2208
+ end
2209
+
2210
+ #
2211
+ # The operation to power off (stop) a virtual machine. The virtual machine can
2212
+ # be restarted with the same provisioned resources. You are still charged for
2213
+ # this virtual machine.
2214
+ #
2215
+ # @param resource_group_name [String] The name of the resource group.
2216
+ # @param vm_name [String] The name of the virtual machine.
2217
+ # @param skip_shutdown [Boolean] The parameter to request non-graceful VM
2218
+ # shutdown. True value for this flag indicates non-graceful shutdown whereas
2219
+ # false indicates otherwise. Default value for this flag is false if not
2220
+ # specified
2221
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2222
+ # to the HTTP request.
2223
+ #
2224
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2225
+ #
2226
+ def begin_power_off_async(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
2227
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2228
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2229
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2230
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2231
+
2232
+
2233
+ request_headers = {}
2234
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2235
+
2236
+ # Set Headers
2237
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2238
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2239
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'
2240
+
2241
+ request_url = @base_url || @client.base_url
2242
+
2243
+ options = {
2244
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2245
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2246
+ query_params: {'skipShutdown' => skip_shutdown,'api-version' => @client.api_version},
2247
+ headers: request_headers.merge(custom_headers || {}),
2248
+ base_url: request_url
2249
+ }
2250
+ promise = @client.make_request_async(:post, path_template, options)
2251
+
2252
+ promise = promise.then do |result|
2253
+ http_response = result.response
2254
+ status_code = http_response.status
2255
+ response_content = http_response.body
2256
+ unless status_code == 200 || status_code == 202
2257
+ error_model = JSON.load(response_content)
2258
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2259
+ end
2260
+
2261
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2262
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2263
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2264
+
2265
+ result
2266
+ end
2267
+
2268
+ promise.execute
2269
+ end
2270
+
2271
+ #
2272
+ # The operation to reapply a virtual machine's state.
2273
+ #
2274
+ # @param resource_group_name [String] The name of the resource group.
2275
+ # @param vm_name [String] The name of the virtual machine.
2276
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2277
+ # will be added to the HTTP request.
2278
+ #
2279
+ #
2280
+ def begin_reapply(resource_group_name, vm_name, custom_headers:nil)
2281
+ response = begin_reapply_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2282
+ nil
2283
+ end
2284
+
2285
+ #
2286
+ # The operation to reapply a virtual machine's state.
2287
+ #
2288
+ # @param resource_group_name [String] The name of the resource group.
2289
+ # @param vm_name [String] The name of the virtual machine.
2290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2291
+ # will be added to the HTTP request.
2292
+ #
2293
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2294
+ #
2295
+ def begin_reapply_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2296
+ begin_reapply_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2297
+ end
2298
+
2299
+ #
2300
+ # The operation to reapply a virtual machine's state.
2301
+ #
2302
+ # @param resource_group_name [String] The name of the resource group.
2303
+ # @param vm_name [String] The name of the virtual machine.
2304
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2305
+ # to the HTTP request.
2306
+ #
2307
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2308
+ #
2309
+ def begin_reapply_async(resource_group_name, vm_name, custom_headers:nil)
2310
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2311
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2312
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2313
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2314
+
2315
+
2316
+ request_headers = {}
2317
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2318
+
2319
+ # Set Headers
2320
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2321
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2322
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'
2323
+
2324
+ request_url = @base_url || @client.base_url
2325
+
2326
+ options = {
2327
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2328
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2329
+ query_params: {'api-version' => @client.api_version},
2330
+ headers: request_headers.merge(custom_headers || {}),
2331
+ base_url: request_url
2332
+ }
2333
+ promise = @client.make_request_async(:post, path_template, options)
2334
+
2335
+ promise = promise.then do |result|
2336
+ http_response = result.response
2337
+ status_code = http_response.status
2338
+ response_content = http_response.body
2339
+ unless status_code == 200 || status_code == 202
2340
+ error_model = JSON.load(response_content)
2341
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2342
+ end
2343
+
2344
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2345
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2346
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2347
+
2348
+ result
2349
+ end
2350
+
2351
+ promise.execute
2352
+ end
2353
+
2354
+ #
2355
+ # The operation to restart a virtual machine.
2356
+ #
2357
+ # @param resource_group_name [String] The name of the resource group.
2358
+ # @param vm_name [String] The name of the virtual machine.
2359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2360
+ # will be added to the HTTP request.
2361
+ #
2362
+ #
2363
+ def begin_restart(resource_group_name, vm_name, custom_headers:nil)
2364
+ response = begin_restart_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2365
+ nil
2366
+ end
2367
+
2368
+ #
2369
+ # The operation to restart a virtual machine.
2370
+ #
2371
+ # @param resource_group_name [String] The name of the resource group.
2372
+ # @param vm_name [String] The name of the virtual machine.
2373
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2374
+ # will be added to the HTTP request.
2375
+ #
2376
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2377
+ #
2378
+ def begin_restart_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2379
+ begin_restart_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2380
+ end
2381
+
2382
+ #
2383
+ # The operation to restart a virtual machine.
2384
+ #
2385
+ # @param resource_group_name [String] The name of the resource group.
2386
+ # @param vm_name [String] The name of the virtual machine.
2387
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2388
+ # to the HTTP request.
2389
+ #
2390
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2391
+ #
2392
+ def begin_restart_async(resource_group_name, vm_name, custom_headers:nil)
2393
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2394
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2395
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2396
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2397
+
2398
+
2399
+ request_headers = {}
2400
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2401
+
2402
+ # Set Headers
2403
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2404
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2405
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'
2406
+
2407
+ request_url = @base_url || @client.base_url
2408
+
2409
+ options = {
2410
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2411
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2412
+ query_params: {'api-version' => @client.api_version},
2413
+ headers: request_headers.merge(custom_headers || {}),
2414
+ base_url: request_url
2415
+ }
2416
+ promise = @client.make_request_async(:post, path_template, options)
2417
+
2418
+ promise = promise.then do |result|
2419
+ http_response = result.response
2420
+ status_code = http_response.status
2421
+ response_content = http_response.body
2422
+ unless status_code == 200 || status_code == 202
2423
+ error_model = JSON.load(response_content)
2424
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2425
+ end
2426
+
2427
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2428
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2429
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2430
+
2431
+ result
2432
+ end
2433
+
2434
+ promise.execute
2435
+ end
2436
+
2437
+ #
2438
+ # The operation to start a virtual machine.
2439
+ #
2440
+ # @param resource_group_name [String] The name of the resource group.
2441
+ # @param vm_name [String] The name of the virtual machine.
2442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2443
+ # will be added to the HTTP request.
2444
+ #
2445
+ #
2446
+ def begin_start(resource_group_name, vm_name, custom_headers:nil)
2447
+ response = begin_start_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2448
+ nil
2449
+ end
2450
+
2451
+ #
2452
+ # The operation to start a virtual machine.
2453
+ #
2454
+ # @param resource_group_name [String] The name of the resource group.
2455
+ # @param vm_name [String] The name of the virtual machine.
2456
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2457
+ # will be added to the HTTP request.
2458
+ #
2459
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2460
+ #
2461
+ def begin_start_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2462
+ begin_start_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2463
+ end
2464
+
2465
+ #
2466
+ # The operation to start a virtual machine.
2467
+ #
2468
+ # @param resource_group_name [String] The name of the resource group.
2469
+ # @param vm_name [String] The name of the virtual machine.
2470
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2471
+ # to the HTTP request.
2472
+ #
2473
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2474
+ #
2475
+ def begin_start_async(resource_group_name, vm_name, custom_headers:nil)
2476
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2477
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2478
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2479
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2480
+
2481
+
2482
+ request_headers = {}
2483
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2484
+
2485
+ # Set Headers
2486
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2487
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2488
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'
2489
+
2490
+ request_url = @base_url || @client.base_url
2491
+
2492
+ options = {
2493
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2494
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2495
+ query_params: {'api-version' => @client.api_version},
2496
+ headers: request_headers.merge(custom_headers || {}),
2497
+ base_url: request_url
2498
+ }
2499
+ promise = @client.make_request_async(:post, path_template, options)
2500
+
2501
+ promise = promise.then do |result|
2502
+ http_response = result.response
2503
+ status_code = http_response.status
2504
+ response_content = http_response.body
2505
+ unless status_code == 200 || status_code == 202
2506
+ error_model = JSON.load(response_content)
2507
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2508
+ end
2509
+
2510
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2511
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2512
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2513
+
2514
+ result
2515
+ end
2516
+
2517
+ promise.execute
2518
+ end
2519
+
2520
+ #
2521
+ # Shuts down the virtual machine, moves it to a new node, and powers it back
2522
+ # on.
2523
+ #
2524
+ # @param resource_group_name [String] The name of the resource group.
2525
+ # @param vm_name [String] The name of the virtual machine.
2526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2527
+ # will be added to the HTTP request.
2528
+ #
2529
+ #
2530
+ def begin_redeploy(resource_group_name, vm_name, custom_headers:nil)
2531
+ response = begin_redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2532
+ nil
2533
+ end
2534
+
2535
+ #
2536
+ # Shuts down the virtual machine, moves it to a new node, and powers it back
2537
+ # on.
2538
+ #
2539
+ # @param resource_group_name [String] The name of the resource group.
2540
+ # @param vm_name [String] The name of the virtual machine.
2541
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2542
+ # will be added to the HTTP request.
2543
+ #
2544
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2545
+ #
2546
+ def begin_redeploy_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2547
+ begin_redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2548
+ end
2549
+
2550
+ #
2551
+ # Shuts down the virtual machine, moves it to a new node, and powers it back
2552
+ # on.
2553
+ #
2554
+ # @param resource_group_name [String] The name of the resource group.
2555
+ # @param vm_name [String] The name of the virtual machine.
2556
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2557
+ # to the HTTP request.
2558
+ #
2559
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2560
+ #
2561
+ def begin_redeploy_async(resource_group_name, vm_name, custom_headers:nil)
2562
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2563
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2564
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2565
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2566
+
2567
+
2568
+ request_headers = {}
2569
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2570
+
2571
+ # Set Headers
2572
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2573
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2574
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'
2575
+
2576
+ request_url = @base_url || @client.base_url
2577
+
2578
+ options = {
2579
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2580
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2581
+ query_params: {'api-version' => @client.api_version},
2582
+ headers: request_headers.merge(custom_headers || {}),
2583
+ base_url: request_url
2584
+ }
2585
+ promise = @client.make_request_async(:post, path_template, options)
2586
+
2587
+ promise = promise.then do |result|
2588
+ http_response = result.response
2589
+ status_code = http_response.status
2590
+ response_content = http_response.body
2591
+ unless status_code == 200 || status_code == 202
2592
+ error_model = JSON.load(response_content)
2593
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2594
+ end
2595
+
2596
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2597
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2598
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2599
+
2600
+ result
2601
+ end
2602
+
2603
+ promise.execute
2604
+ end
2605
+
2606
+ #
2607
+ # Reimages the virtual machine which has an ephemeral OS disk back to its
2608
+ # initial state.
2609
+ #
2610
+ # @param resource_group_name [String] The name of the resource group.
2611
+ # @param vm_name [String] The name of the virtual machine.
2612
+ # @param parameters [VirtualMachineReimageParameters] Parameters supplied to
2613
+ # the Reimage Virtual Machine operation.
2614
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2615
+ # will be added to the HTTP request.
2616
+ #
2617
+ #
2618
+ def begin_reimage(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
2619
+ response = begin_reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers:custom_headers).value!
2620
+ nil
2621
+ end
2622
+
2623
+ #
2624
+ # Reimages the virtual machine which has an ephemeral OS disk back to its
2625
+ # initial state.
2626
+ #
2627
+ # @param resource_group_name [String] The name of the resource group.
2628
+ # @param vm_name [String] The name of the virtual machine.
2629
+ # @param parameters [VirtualMachineReimageParameters] Parameters supplied to
2630
+ # the Reimage Virtual Machine operation.
2631
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2632
+ # will be added to the HTTP request.
2633
+ #
2634
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2635
+ #
2636
+ def begin_reimage_with_http_info(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
2637
+ begin_reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers:custom_headers).value!
2638
+ end
2639
+
2640
+ #
2641
+ # Reimages the virtual machine which has an ephemeral OS disk back to its
2642
+ # initial state.
2643
+ #
2644
+ # @param resource_group_name [String] The name of the resource group.
2645
+ # @param vm_name [String] The name of the virtual machine.
2646
+ # @param parameters [VirtualMachineReimageParameters] Parameters supplied to
2647
+ # the Reimage Virtual Machine operation.
2648
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2649
+ # to the HTTP request.
2650
+ #
2651
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2652
+ #
2653
+ def begin_reimage_async(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
2654
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2655
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2656
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2657
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2658
+
2659
+
2660
+ request_headers = {}
2661
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2662
+
2663
+ # Set Headers
2664
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2665
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2666
+
2667
+ # Serialize Request
2668
+ request_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineReimageParameters.mapper()
2669
+ request_content = @client.serialize(request_mapper, parameters)
2670
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2671
+
2672
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'
2673
+
2674
+ request_url = @base_url || @client.base_url
2675
+
2676
+ options = {
2677
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2678
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2679
+ query_params: {'api-version' => @client.api_version},
2680
+ body: request_content,
2681
+ headers: request_headers.merge(custom_headers || {}),
2682
+ base_url: request_url
2683
+ }
2684
+ promise = @client.make_request_async(:post, path_template, options)
2685
+
2686
+ promise = promise.then do |result|
2687
+ http_response = result.response
2688
+ status_code = http_response.status
2689
+ response_content = http_response.body
2690
+ unless status_code == 200 || status_code == 202
2691
+ error_model = JSON.load(response_content)
2692
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2693
+ end
2694
+
2695
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2696
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2697
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2698
+
2699
+ result
2700
+ end
2701
+
2702
+ promise.execute
2703
+ end
2704
+
2705
+ #
2706
+ # The operation to perform maintenance on a virtual machine.
2707
+ #
2708
+ # @param resource_group_name [String] The name of the resource group.
2709
+ # @param vm_name [String] The name of the virtual machine.
2710
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2711
+ # will be added to the HTTP request.
2712
+ #
2713
+ #
2714
+ def begin_perform_maintenance(resource_group_name, vm_name, custom_headers:nil)
2715
+ response = begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2716
+ nil
2717
+ end
2718
+
2719
+ #
2720
+ # The operation to perform maintenance on a virtual machine.
2721
+ #
2722
+ # @param resource_group_name [String] The name of the resource group.
2723
+ # @param vm_name [String] The name of the virtual machine.
2724
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2725
+ # will be added to the HTTP request.
2726
+ #
2727
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2728
+ #
2729
+ def begin_perform_maintenance_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2730
+ begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2731
+ end
2732
+
2733
+ #
2734
+ # The operation to perform maintenance on a virtual machine.
2735
+ #
2736
+ # @param resource_group_name [String] The name of the resource group.
2737
+ # @param vm_name [String] The name of the virtual machine.
2738
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2739
+ # to the HTTP request.
2740
+ #
2741
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2742
+ #
2743
+ def begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers:nil)
2744
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2745
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2746
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2747
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2748
+
2749
+
2750
+ request_headers = {}
2751
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2752
+
2753
+ # Set Headers
2754
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2755
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2756
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'
2757
+
2758
+ request_url = @base_url || @client.base_url
2759
+
2760
+ options = {
2761
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2762
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2763
+ query_params: {'api-version' => @client.api_version},
2764
+ headers: request_headers.merge(custom_headers || {}),
2765
+ base_url: request_url
2766
+ }
2767
+ promise = @client.make_request_async(:post, path_template, options)
2768
+
2769
+ promise = promise.then do |result|
2770
+ http_response = result.response
2771
+ status_code = http_response.status
2772
+ response_content = http_response.body
2773
+ unless status_code == 200 || status_code == 202
2774
+ error_model = JSON.load(response_content)
2775
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2776
+ end
2777
+
2778
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2779
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2780
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2781
+
2782
+ result
2783
+ end
2784
+
2785
+ promise.execute
2786
+ end
2787
+
2788
+ #
2789
+ # Assess patches on the VM.
2790
+ #
2791
+ # @param resource_group_name [String] The name of the resource group.
2792
+ # @param vm_name [String] The name of the virtual machine.
2793
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2794
+ # will be added to the HTTP request.
2795
+ #
2796
+ # @return [VirtualMachineAssessPatchesResult] operation results.
2797
+ #
2798
+ def begin_assess_patches(resource_group_name, vm_name, custom_headers:nil)
2799
+ response = begin_assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2800
+ response.body unless response.nil?
2801
+ end
2802
+
2803
+ #
2804
+ # Assess patches on the VM.
2805
+ #
2806
+ # @param resource_group_name [String] The name of the resource group.
2807
+ # @param vm_name [String] The name of the virtual machine.
2808
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2809
+ # will be added to the HTTP request.
2810
+ #
2811
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2812
+ #
2813
+ def begin_assess_patches_with_http_info(resource_group_name, vm_name, custom_headers:nil)
2814
+ begin_assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
2815
+ end
2816
+
2817
+ #
2818
+ # Assess patches on the VM.
2819
+ #
2820
+ # @param resource_group_name [String] The name of the resource group.
2821
+ # @param vm_name [String] The name of the virtual machine.
2822
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2823
+ # to the HTTP request.
2824
+ #
2825
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2826
+ #
2827
+ def begin_assess_patches_async(resource_group_name, vm_name, custom_headers:nil)
2828
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2829
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2830
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2831
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2832
+
2833
+
2834
+ request_headers = {}
2835
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2836
+
2837
+ # Set Headers
2838
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2839
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2840
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'
2841
+
2842
+ request_url = @base_url || @client.base_url
2843
+
2844
+ options = {
2845
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2846
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2847
+ query_params: {'api-version' => @client.api_version},
2848
+ headers: request_headers.merge(custom_headers || {}),
2849
+ base_url: request_url
2850
+ }
2851
+ promise = @client.make_request_async(:post, path_template, options)
2852
+
2853
+ promise = promise.then do |result|
2854
+ http_response = result.response
2855
+ status_code = http_response.status
2856
+ response_content = http_response.body
2857
+ unless status_code == 200 || status_code == 202
2858
+ error_model = JSON.load(response_content)
2859
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2860
+ end
2861
+
2862
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2863
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2864
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2865
+ # Deserialize Response
2866
+ if status_code == 200
2867
+ begin
2868
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2869
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineAssessPatchesResult.mapper()
2870
+ result.body = @client.deserialize(result_mapper, parsed_response)
2871
+ rescue Exception => e
2872
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2873
+ end
2874
+ end
2875
+
2876
+ result
2877
+ end
2878
+
2879
+ promise.execute
2880
+ end
2881
+
2882
+ #
2883
+ # Installs patches on the VM.
2884
+ #
2885
+ # @param resource_group_name [String] The name of the resource group.
2886
+ # @param vm_name [String] The name of the virtual machine.
2887
+ # @param install_patches_input [VirtualMachineInstallPatchesParameters] Input
2888
+ # for InstallPatches as directly received by the API
2889
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2890
+ # will be added to the HTTP request.
2891
+ #
2892
+ # @return [VirtualMachineInstallPatchesResult] operation results.
2893
+ #
2894
+ def begin_install_patches(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
2895
+ response = begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers).value!
2896
+ response.body unless response.nil?
2897
+ end
2898
+
2899
+ #
2900
+ # Installs patches on the VM.
2901
+ #
2902
+ # @param resource_group_name [String] The name of the resource group.
2903
+ # @param vm_name [String] The name of the virtual machine.
2904
+ # @param install_patches_input [VirtualMachineInstallPatchesParameters] Input
2905
+ # for InstallPatches as directly received by the API
2906
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2907
+ # will be added to the HTTP request.
2908
+ #
2909
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2910
+ #
2911
+ def begin_install_patches_with_http_info(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
2912
+ begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers).value!
2913
+ end
2914
+
2915
+ #
2916
+ # Installs patches on the VM.
2917
+ #
2918
+ # @param resource_group_name [String] The name of the resource group.
2919
+ # @param vm_name [String] The name of the virtual machine.
2920
+ # @param install_patches_input [VirtualMachineInstallPatchesParameters] Input
2921
+ # for InstallPatches as directly received by the API
2922
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2923
+ # to the HTTP request.
2924
+ #
2925
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2926
+ #
2927
+ def begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
2928
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2929
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
2930
+ fail ArgumentError, 'install_patches_input is nil' if install_patches_input.nil?
2931
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2932
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2933
+
2934
+
2935
+ request_headers = {}
2936
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2937
+
2938
+ # Set Headers
2939
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2940
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2941
+
2942
+ # Serialize Request
2943
+ request_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstallPatchesParameters.mapper()
2944
+ request_content = @client.serialize(request_mapper, install_patches_input)
2945
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2946
+
2947
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'
2948
+
2949
+ request_url = @base_url || @client.base_url
2950
+
2951
+ options = {
2952
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2953
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
2954
+ query_params: {'api-version' => @client.api_version},
2955
+ body: request_content,
2956
+ headers: request_headers.merge(custom_headers || {}),
2957
+ base_url: request_url
2958
+ }
2959
+ promise = @client.make_request_async(:post, path_template, options)
2960
+
2961
+ promise = promise.then do |result|
2962
+ http_response = result.response
2963
+ status_code = http_response.status
2964
+ response_content = http_response.body
2965
+ unless status_code == 200 || status_code == 202
2966
+ error_model = JSON.load(response_content)
2967
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2968
+ end
2969
+
2970
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2971
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2972
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2973
+ # Deserialize Response
2974
+ if status_code == 200
2975
+ begin
2976
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2977
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstallPatchesResult.mapper()
2978
+ result.body = @client.deserialize(result_mapper, parsed_response)
2979
+ rescue Exception => e
2980
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2981
+ end
2982
+ end
2983
+
2984
+ result
2985
+ end
2986
+
2987
+ promise.execute
2988
+ end
2989
+
2990
+ #
2991
+ # Run command on the VM.
2992
+ #
2993
+ # @param resource_group_name [String] The name of the resource group.
2994
+ # @param vm_name [String] The name of the virtual machine.
2995
+ # @param parameters [RunCommandInput] Parameters supplied to the Run command
2996
+ # operation.
2997
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2998
+ # will be added to the HTTP request.
2999
+ #
3000
+ # @return [RunCommandResult] operation results.
3001
+ #
3002
+ def begin_run_command(resource_group_name, vm_name, parameters, custom_headers:nil)
3003
+ response = begin_run_command_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
3004
+ response.body unless response.nil?
3005
+ end
3006
+
3007
+ #
3008
+ # Run command on the VM.
3009
+ #
3010
+ # @param resource_group_name [String] The name of the resource group.
3011
+ # @param vm_name [String] The name of the virtual machine.
3012
+ # @param parameters [RunCommandInput] Parameters supplied to the Run command
3013
+ # operation.
3014
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3015
+ # will be added to the HTTP request.
3016
+ #
3017
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3018
+ #
3019
+ def begin_run_command_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
3020
+ begin_run_command_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
3021
+ end
3022
+
3023
+ #
3024
+ # Run command on the VM.
3025
+ #
3026
+ # @param resource_group_name [String] The name of the resource group.
3027
+ # @param vm_name [String] The name of the virtual machine.
3028
+ # @param parameters [RunCommandInput] Parameters supplied to the Run command
3029
+ # operation.
3030
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3031
+ # to the HTTP request.
3032
+ #
3033
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3034
+ #
3035
+ def begin_run_command_async(resource_group_name, vm_name, parameters, custom_headers:nil)
3036
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
3037
+ fail ArgumentError, 'vm_name is nil' if vm_name.nil?
3038
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
3039
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
3040
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
3041
+
3042
+
3043
+ request_headers = {}
3044
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3045
+
3046
+ # Set Headers
3047
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3048
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3049
+
3050
+ # Serialize Request
3051
+ request_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RunCommandInput.mapper()
3052
+ request_content = @client.serialize(request_mapper, parameters)
3053
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
3054
+
3055
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'
3056
+
3057
+ request_url = @base_url || @client.base_url
3058
+
3059
+ options = {
3060
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3061
+ path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id},
3062
+ query_params: {'api-version' => @client.api_version},
3063
+ body: request_content,
3064
+ headers: request_headers.merge(custom_headers || {}),
3065
+ base_url: request_url
3066
+ }
3067
+ promise = @client.make_request_async(:post, path_template, options)
3068
+
3069
+ promise = promise.then do |result|
3070
+ http_response = result.response
3071
+ status_code = http_response.status
3072
+ response_content = http_response.body
3073
+ unless status_code == 200 || status_code == 202
3074
+ error_model = JSON.load(response_content)
3075
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3076
+ end
3077
+
3078
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3079
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3080
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3081
+ # Deserialize Response
3082
+ if status_code == 200
3083
+ begin
3084
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3085
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RunCommandResult.mapper()
3086
+ result.body = @client.deserialize(result_mapper, parsed_response)
3087
+ rescue Exception => e
3088
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3089
+ end
3090
+ end
3091
+
3092
+ result
3093
+ end
3094
+
3095
+ promise.execute
3096
+ end
3097
+
3098
+ #
3099
+ # Gets all the virtual machines under the specified subscription for the
3100
+ # specified location.
3101
+ #
3102
+ # @param next_page_link [String] The NextLink from the previous successful call
3103
+ # to List operation.
3104
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3105
+ # will be added to the HTTP request.
3106
+ #
3107
+ # @return [VirtualMachineListResult] operation results.
3108
+ #
3109
+ def list_by_location_next(next_page_link, custom_headers:nil)
3110
+ response = list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
3111
+ response.body unless response.nil?
3112
+ end
3113
+
3114
+ #
3115
+ # Gets all the virtual machines under the specified subscription for the
3116
+ # specified location.
3117
+ #
3118
+ # @param next_page_link [String] The NextLink from the previous successful call
3119
+ # to List operation.
3120
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3121
+ # will be added to the HTTP request.
3122
+ #
3123
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3124
+ #
3125
+ def list_by_location_next_with_http_info(next_page_link, custom_headers:nil)
3126
+ list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
3127
+ end
3128
+
3129
+ #
3130
+ # Gets all the virtual machines under the specified subscription for the
3131
+ # specified location.
3132
+ #
3133
+ # @param next_page_link [String] The NextLink from the previous successful call
3134
+ # to List operation.
3135
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3136
+ # to the HTTP request.
3137
+ #
3138
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3139
+ #
3140
+ def list_by_location_next_async(next_page_link, custom_headers:nil)
3141
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3142
+
3143
+
3144
+ request_headers = {}
3145
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3146
+
3147
+ # Set Headers
3148
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3149
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3150
+ path_template = '{nextLink}'
3151
+
3152
+ request_url = @base_url || @client.base_url
3153
+
3154
+ options = {
3155
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3156
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3157
+ headers: request_headers.merge(custom_headers || {}),
3158
+ base_url: request_url
3159
+ }
3160
+ promise = @client.make_request_async(:get, path_template, options)
3161
+
3162
+ promise = promise.then do |result|
3163
+ http_response = result.response
3164
+ status_code = http_response.status
3165
+ response_content = http_response.body
3166
+ unless status_code == 200
3167
+ error_model = JSON.load(response_content)
3168
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3169
+ end
3170
+
3171
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3172
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3173
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3174
+ # Deserialize Response
3175
+ if status_code == 200
3176
+ begin
3177
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3178
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
3179
+ result.body = @client.deserialize(result_mapper, parsed_response)
3180
+ rescue Exception => e
3181
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3182
+ end
3183
+ end
3184
+
3185
+ result
3186
+ end
3187
+
3188
+ promise.execute
3189
+ end
3190
+
3191
+ #
3192
+ # Lists all of the virtual machines in the specified resource group. Use the
3193
+ # nextLink property in the response to get the next page of virtual machines.
3194
+ #
3195
+ # @param next_page_link [String] The NextLink from the previous successful call
3196
+ # to List operation.
3197
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3198
+ # will be added to the HTTP request.
3199
+ #
3200
+ # @return [VirtualMachineListResult] operation results.
3201
+ #
3202
+ def list_next(next_page_link, custom_headers:nil)
3203
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
3204
+ response.body unless response.nil?
3205
+ end
3206
+
3207
+ #
3208
+ # Lists all of the virtual machines in the specified resource group. Use the
3209
+ # nextLink property in the response to get the next page of virtual machines.
3210
+ #
3211
+ # @param next_page_link [String] The NextLink from the previous successful call
3212
+ # to List operation.
3213
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3214
+ # will be added to the HTTP request.
3215
+ #
3216
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3217
+ #
3218
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
3219
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
3220
+ end
3221
+
3222
+ #
3223
+ # Lists all of the virtual machines in the specified resource group. Use the
3224
+ # nextLink property in the response to get the next page of virtual machines.
3225
+ #
3226
+ # @param next_page_link [String] The NextLink from the previous successful call
3227
+ # to List operation.
3228
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3229
+ # to the HTTP request.
3230
+ #
3231
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3232
+ #
3233
+ def list_next_async(next_page_link, custom_headers:nil)
3234
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3235
+
3236
+
3237
+ request_headers = {}
3238
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3239
+
3240
+ # Set Headers
3241
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3242
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3243
+ path_template = '{nextLink}'
3244
+
3245
+ request_url = @base_url || @client.base_url
3246
+
3247
+ options = {
3248
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3249
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3250
+ headers: request_headers.merge(custom_headers || {}),
3251
+ base_url: request_url
3252
+ }
3253
+ promise = @client.make_request_async(:get, path_template, options)
3254
+
3255
+ promise = promise.then do |result|
3256
+ http_response = result.response
3257
+ status_code = http_response.status
3258
+ response_content = http_response.body
3259
+ unless status_code == 200
3260
+ error_model = JSON.load(response_content)
3261
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3262
+ end
3263
+
3264
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3265
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3266
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3267
+ # Deserialize Response
3268
+ if status_code == 200
3269
+ begin
3270
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3271
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
3272
+ result.body = @client.deserialize(result_mapper, parsed_response)
3273
+ rescue Exception => e
3274
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3275
+ end
3276
+ end
3277
+
3278
+ result
3279
+ end
3280
+
3281
+ promise.execute
3282
+ end
3283
+
3284
+ #
3285
+ # Lists all of the virtual machines in the specified subscription. Use the
3286
+ # nextLink property in the response to get the next page of virtual machines.
3287
+ #
3288
+ # @param next_page_link [String] The NextLink from the previous successful call
3289
+ # to List operation.
3290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3291
+ # will be added to the HTTP request.
3292
+ #
3293
+ # @return [VirtualMachineListResult] operation results.
3294
+ #
3295
+ def list_all_next(next_page_link, custom_headers:nil)
3296
+ response = list_all_next_async(next_page_link, custom_headers:custom_headers).value!
3297
+ response.body unless response.nil?
3298
+ end
3299
+
3300
+ #
3301
+ # Lists all of the virtual machines in the specified subscription. Use the
3302
+ # nextLink property in the response to get the next page of virtual machines.
3303
+ #
3304
+ # @param next_page_link [String] The NextLink from the previous successful call
3305
+ # to List operation.
3306
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3307
+ # will be added to the HTTP request.
3308
+ #
3309
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3310
+ #
3311
+ def list_all_next_with_http_info(next_page_link, custom_headers:nil)
3312
+ list_all_next_async(next_page_link, custom_headers:custom_headers).value!
3313
+ end
3314
+
3315
+ #
3316
+ # Lists all of the virtual machines in the specified subscription. Use the
3317
+ # nextLink property in the response to get the next page of virtual machines.
3318
+ #
3319
+ # @param next_page_link [String] The NextLink from the previous successful call
3320
+ # to List operation.
3321
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3322
+ # to the HTTP request.
3323
+ #
3324
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3325
+ #
3326
+ def list_all_next_async(next_page_link, custom_headers:nil)
3327
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3328
+
3329
+
3330
+ request_headers = {}
3331
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3332
+
3333
+ # Set Headers
3334
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3335
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3336
+ path_template = '{nextLink}'
3337
+
3338
+ request_url = @base_url || @client.base_url
3339
+
3340
+ options = {
3341
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3342
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3343
+ headers: request_headers.merge(custom_headers || {}),
3344
+ base_url: request_url
3345
+ }
3346
+ promise = @client.make_request_async(:get, path_template, options)
3347
+
3348
+ promise = promise.then do |result|
3349
+ http_response = result.response
3350
+ status_code = http_response.status
3351
+ response_content = http_response.body
3352
+ unless status_code == 200
3353
+ error_model = JSON.load(response_content)
3354
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3355
+ end
3356
+
3357
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3358
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3359
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3360
+ # Deserialize Response
3361
+ if status_code == 200
3362
+ begin
3363
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3364
+ result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
3365
+ result.body = @client.deserialize(result_mapper, parsed_response)
3366
+ rescue Exception => e
3367
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3368
+ end
3369
+ end
3370
+
3371
+ result
3372
+ end
3373
+
3374
+ promise.execute
3375
+ end
3376
+
3377
+ #
3378
+ # Gets all the virtual machines under the specified subscription for the
3379
+ # specified location.
3380
+ #
3381
+ # @param location [String] The location for which virtual machines under the
3382
+ # subscription are queried.
3383
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3384
+ # will be added to the HTTP request.
3385
+ #
3386
+ # @return [VirtualMachineListResult] which provide lazy access to pages of the
3387
+ # response.
3388
+ #
3389
+ def list_by_location_as_lazy(location, custom_headers:nil)
3390
+ response = list_by_location_async(location, custom_headers:custom_headers).value!
3391
+ unless response.nil?
3392
+ page = response.body
3393
+ page.next_method = Proc.new do |next_page_link|
3394
+ list_by_location_next_async(next_page_link, custom_headers:custom_headers)
3395
+ end
3396
+ page
3397
+ end
3398
+ end
3399
+
3400
+ #
3401
+ # Lists all of the virtual machines in the specified resource group. Use the
3402
+ # nextLink property in the response to get the next page of virtual machines.
3403
+ #
3404
+ # @param resource_group_name [String] The name of the resource group.
3405
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3406
+ # will be added to the HTTP request.
3407
+ #
3408
+ # @return [VirtualMachineListResult] which provide lazy access to pages of the
3409
+ # response.
3410
+ #
3411
+ def list_as_lazy(resource_group_name, custom_headers:nil)
3412
+ response = list_async(resource_group_name, custom_headers:custom_headers).value!
3413
+ unless response.nil?
3414
+ page = response.body
3415
+ page.next_method = Proc.new do |next_page_link|
3416
+ list_next_async(next_page_link, custom_headers:custom_headers)
3417
+ end
3418
+ page
3419
+ end
3420
+ end
3421
+
3422
+ #
3423
+ # Lists all of the virtual machines in the specified subscription. Use the
3424
+ # nextLink property in the response to get the next page of virtual machines.
3425
+ #
3426
+ # @param status_only [String] statusOnly=true enables fetching run time status
3427
+ # of all Virtual Machines in the subscription.
3428
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3429
+ # will be added to the HTTP request.
3430
+ #
3431
+ # @return [VirtualMachineListResult] which provide lazy access to pages of the
3432
+ # response.
3433
+ #
3434
+ def list_all_as_lazy(status_only:nil, custom_headers:nil)
3435
+ response = list_all_async(status_only:status_only, custom_headers:custom_headers).value!
3436
+ unless response.nil?
3437
+ page = response.body
3438
+ page.next_method = Proc.new do |next_page_link|
3439
+ list_all_next_async(next_page_link, custom_headers:custom_headers)
3440
+ end
3441
+ page
3442
+ end
3443
+ end
3444
+
3445
+ end
3446
+ end