Class: Azure::ARM::Compute::VirtualMachines
- Inherits:
-
Object
- Object
- Azure::ARM::Compute::VirtualMachines
- Includes:
- Models, MsRestAzure
- Defined in:
- lib/azure_mgmt_compute/virtual_machines.rb
Overview
The Compute Management Client.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Reference to the ComputeManagementClient.
Instance Method Summary collapse
-
#begin_capture(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ VirtualMachineCaptureResult
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
-
#begin_capture_async(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
-
#begin_capture_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
-
#begin_create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ VirtualMachine
The operation to create or update a virtual machine.
-
#begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
The operation to create or update a virtual machine.
-
#begin_create_or_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to create or update a virtual machine.
-
#begin_deallocate(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
Shuts down the Virtual Machine and releases the compute resources.
-
#begin_deallocate_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Shuts down the Virtual Machine and releases the compute resources.
-
#begin_deallocate_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Shuts down the Virtual Machine and releases the compute resources.
-
#begin_delete(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to delete a virtual machine.
-
#begin_delete_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to delete a virtual machine.
-
#begin_delete_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to delete a virtual machine.
-
#begin_power_off(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to power off (stop) a virtual machine.
-
#begin_power_off_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to power off (stop) a virtual machine.
-
#begin_power_off_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to power off (stop) a virtual machine.
-
#begin_redeploy(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to redeploy a virtual machine.
-
#begin_redeploy_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to redeploy a virtual machine.
-
#begin_redeploy_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to redeploy a virtual machine.
-
#begin_restart(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to restart a virtual machine.
-
#begin_restart_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to restart a virtual machine.
-
#begin_restart_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to restart a virtual machine.
-
#begin_start(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to start a virtual machine.
-
#begin_start_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to start a virtual machine.
-
#begin_start_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to start a virtual machine.
-
#capture(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
-
#create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
The operation to create or update a virtual machine.
-
#deallocate(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Shuts down the Virtual Machine and releases the compute resources.
-
#delete(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to delete a virtual machine.
-
#generalize(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
Sets the state of the VM as Generalized.
-
#generalize_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Sets the state of the VM as Generalized.
-
#generalize_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Sets the state of the VM as Generalized.
-
#get(resource_group_name, vm_name, expand = nil, custom_headers = nil) ⇒ VirtualMachine
The operation to get a virtual machine.
-
#get_async(resource_group_name, vm_name, expand = nil, custom_headers = nil) ⇒ Concurrent::Promise
The operation to get a virtual machine.
-
#get_with_http_info(resource_group_name, vm_name, expand = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to get a virtual machine.
-
#initialize(client) ⇒ VirtualMachines
constructor
Creates and initializes a new instance of the VirtualMachines class.
-
#list(resource_group_name, custom_headers = nil) ⇒ VirtualMachineListResult
The operation to list virtual machines under a resource group.
-
#list_all(custom_headers = nil) ⇒ VirtualMachineListResult
Gets the list of Virtual Machines in the subscription.
-
#list_all_async(custom_headers = nil) ⇒ Concurrent::Promise
Gets the list of Virtual Machines in the subscription.
-
#list_all_next(next_page_link, custom_headers = nil) ⇒ VirtualMachineListResult
Gets the list of Virtual Machines in the subscription.
-
#list_all_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise
Gets the list of Virtual Machines in the subscription.
-
#list_all_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Gets the list of Virtual Machines in the subscription.
-
#list_all_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Gets the list of Virtual Machines in the subscription.
-
#list_async(resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to list virtual machines under a resource group.
-
#list_available_sizes(resource_group_name, vm_name, custom_headers = nil) ⇒ VirtualMachineSizeListResult
Lists all available virtual machine sizes it can be resized to for a virtual machine.
-
#list_available_sizes_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Lists all available virtual machine sizes it can be resized to for a virtual machine.
-
#list_available_sizes_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Lists all available virtual machine sizes it can be resized to for a virtual machine.
-
#list_with_http_info(resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to list virtual machines under a resource group.
-
#power_off(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to power off (stop) a virtual machine.
-
#redeploy(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to redeploy a virtual machine.
-
#restart(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to restart a virtual machine.
-
#start(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to start a virtual machine.
Constructor Details
#initialize(client) ⇒ VirtualMachines
Creates and initializes a new instance of the VirtualMachines class.
18 19 20 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 18 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns reference to the ComputeManagementClient.
23 24 25 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 23 def client @client end |
Instance Method Details
#begin_capture(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ VirtualMachineCaptureResult
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
the Capture Virtual Machine operation. will be added to the HTTP request.
68 69 70 71 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 68 def begin_capture(resource_group_name, vm_name, parameters, custom_headers = nil) response = begin_capture_async(resource_group_name, vm_name, parameters, custom_headers).value! response.body unless response.nil? end |
#begin_capture_async(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
the Capture Virtual Machine operation. to the HTTP request.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 103 def begin_capture_async(resource_group_name, vm_name, parameters, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? parameters.validate unless parameters.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_headers['Content-Type'] = 'application/json; charset=utf-8' unless parameters.nil? parameters = VirtualMachineCaptureParameters.serialize_object(parameters) end request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachineCaptureResult.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#begin_capture_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
the Capture Virtual Machine operation. will be added to the HTTP request.
86 87 88 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 86 def begin_capture_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil) begin_capture_async(resource_group_name, vm_name, parameters, custom_headers).value! end |
#begin_create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ VirtualMachine
The operation to create or update a virtual machine.
Machine operation. will be added to the HTTP request.
216 217 218 219 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 216 def begin_create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil) response = begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers).value! response.body unless response.nil? end |
#begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
The operation to create or update a virtual machine.
Machine operation. to the HTTP request.
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 249 def begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? parameters.validate unless parameters.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_headers['Content-Type'] = 'application/json; charset=utf-8' unless parameters.nil? parameters = VirtualMachine.serialize_object(parameters) end request_content = parameters != nil ? JSON.generate(parameters, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 || status_code == 201 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachine.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end # Deserialize Response if status_code == 201 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachine.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#begin_create_or_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to create or update a virtual machine.
Machine operation. will be added to the HTTP request.
233 234 235 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 233 def begin_create_or_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil) begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers).value! end |
#begin_deallocate(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
Shuts down the Virtual Machine and releases the compute resources. You are not billed for the compute resources that this Virtual Machine uses.
will be added to the HTTP request.
566 567 568 569 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 566 def begin_deallocate(resource_group_name, vm_name, custom_headers = nil) response = begin_deallocate_async(resource_group_name, vm_name, custom_headers).value! nil end |
#begin_deallocate_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Shuts down the Virtual Machine and releases the compute resources. You are not billed for the compute resources that this Virtual Machine uses.
to the HTTP request.
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 597 def begin_deallocate_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end |
#begin_deallocate_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Shuts down the Virtual Machine and releases the compute resources. You are not billed for the compute resources that this Virtual Machine uses.
will be added to the HTTP request.
582 583 584 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 582 def begin_deallocate_with_http_info(resource_group_name, vm_name, custom_headers = nil) begin_deallocate_async(resource_group_name, vm_name, custom_headers).value! end |
#begin_delete(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to delete a virtual machine.
will be added to the HTTP request.
359 360 361 362 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 359 def begin_delete(resource_group_name, vm_name, custom_headers = nil) response = begin_delete_async(resource_group_name, vm_name, custom_headers).value! nil end |
#begin_delete_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to delete a virtual machine.
to the HTTP request.
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 388 def begin_delete_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 || status_code == 204 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end |
#begin_delete_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to delete a virtual machine.
will be added to the HTTP request.
374 375 376 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 374 def begin_delete_with_http_info(resource_group_name, vm_name, custom_headers = nil) begin_delete_async(resource_group_name, vm_name, custom_headers).value! end |
#begin_power_off(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to power off (stop) a virtual machine.
will be added to the HTTP request.
1033 1034 1035 1036 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1033 def begin_power_off(resource_group_name, vm_name, custom_headers = nil) response = begin_power_off_async(resource_group_name, vm_name, custom_headers).value! nil end |
#begin_power_off_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to power off (stop) a virtual machine.
to the HTTP request.
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1062 def begin_power_off_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end |
#begin_power_off_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to power off (stop) a virtual machine.
will be added to the HTTP request.
1048 1049 1050 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1048 def begin_power_off_with_http_info(resource_group_name, vm_name, custom_headers = nil) begin_power_off_async(resource_group_name, vm_name, custom_headers).value! end |
#begin_redeploy(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to redeploy a virtual machine.
will be added to the HTTP request.
1348 1349 1350 1351 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1348 def begin_redeploy(resource_group_name, vm_name, custom_headers = nil) response = begin_redeploy_async(resource_group_name, vm_name, custom_headers).value! nil end |
#begin_redeploy_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to redeploy a virtual machine.
to the HTTP request.
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1377 def begin_redeploy_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end |
#begin_redeploy_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to redeploy a virtual machine.
will be added to the HTTP request.
1363 1364 1365 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1363 def begin_redeploy_with_http_info(resource_group_name, vm_name, custom_headers = nil) begin_redeploy_async(resource_group_name, vm_name, custom_headers).value! end |
#begin_restart(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to restart a virtual machine.
will be added to the HTTP request.
1138 1139 1140 1141 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1138 def begin_restart(resource_group_name, vm_name, custom_headers = nil) response = begin_restart_async(resource_group_name, vm_name, custom_headers).value! nil end |
#begin_restart_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to restart a virtual machine.
to the HTTP request.
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1167 def begin_restart_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end |
#begin_restart_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to restart a virtual machine.
will be added to the HTTP request.
1153 1154 1155 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1153 def begin_restart_with_http_info(resource_group_name, vm_name, custom_headers = nil) begin_restart_async(resource_group_name, vm_name, custom_headers).value! end |
#begin_start(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
The operation to start a virtual machine.
will be added to the HTTP request.
1243 1244 1245 1246 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1243 def begin_start(resource_group_name, vm_name, custom_headers = nil) response = begin_start_async(resource_group_name, vm_name, custom_headers).value! nil end |
#begin_start_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to start a virtual machine.
to the HTTP request.
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1272 def begin_start_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end |
#begin_start_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to start a virtual machine.
will be added to the HTTP request.
1258 1259 1260 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1258 def begin_start_with_http_info(resource_group_name, vm_name, custom_headers = nil) begin_start_async(resource_group_name, vm_name, custom_headers).value! end |
#capture(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.
the Capture Virtual Machine operation. response.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 36 def capture(resource_group_name, vm_name, parameters, custom_headers = nil) # Send request promise = begin_capture_async(resource_group_name, vm_name, parameters, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| unless parsed_response.nil? parsed_response = VirtualMachineCaptureResult.deserialize_object(parsed_response) end end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |
#create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise
The operation to create or update a virtual machine.
Machine operation. uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. for the response.
response.
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 185 def create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil) # Send request promise = begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| unless parsed_response.nil? parsed_response = VirtualMachine.deserialize_object(parsed_response) end end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |
#deallocate(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Shuts down the Virtual Machine and releases the compute resources. You are not billed for the compute resources that this Virtual Machine uses.
response.
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 540 def deallocate(resource_group_name, vm_name, custom_headers = nil) # Send request promise = begin_deallocate_async(resource_group_name, vm_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |
#delete(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to delete a virtual machine.
response.
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 334 def delete(resource_group_name, vm_name, custom_headers = nil) # Send request promise = begin_delete_async(resource_group_name, vm_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |
#generalize(resource_group_name, vm_name, custom_headers = nil) ⇒ Object
Sets the state of the VM as Generalized.
will be added to the HTTP request.
649 650 651 652 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 649 def generalize(resource_group_name, vm_name, custom_headers = nil) response = generalize_async(resource_group_name, vm_name, custom_headers).value! nil end |
#generalize_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Sets the state of the VM as Generalized.
to the HTTP request.
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 678 def generalize_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end |
#generalize_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Sets the state of the VM as Generalized.
will be added to the HTTP request.
664 665 666 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 664 def generalize_with_http_info(resource_group_name, vm_name, custom_headers = nil) generalize_async(resource_group_name, vm_name, custom_headers).value! end |
#get(resource_group_name, vm_name, expand = nil, custom_headers = nil) ⇒ VirtualMachine
The operation to get a virtual machine.
operation. Possible values include: ‘instanceView’ will be added to the HTTP request.
443 444 445 446 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 443 def get(resource_group_name, vm_name, = nil, custom_headers = nil) response = get_async(resource_group_name, vm_name, , custom_headers).value! response.body unless response.nil? end |
#get_async(resource_group_name, vm_name, expand = nil, custom_headers = nil) ⇒ Concurrent::Promise
The operation to get a virtual machine.
operation. Possible values include: ‘instanceView’ to the HTTP request.
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 476 def get_async(resource_group_name, vm_name, = nil, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'$expand' => ,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachine.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#get_with_http_info(resource_group_name, vm_name, expand = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to get a virtual machine.
operation. Possible values include: ‘instanceView’ will be added to the HTTP request.
460 461 462 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 460 def get_with_http_info(resource_group_name, vm_name, = nil, custom_headers = nil) get_async(resource_group_name, vm_name, , custom_headers).value! end |
#list(resource_group_name, custom_headers = nil) ⇒ VirtualMachineListResult
The operation to list virtual machines under a resource group.
will be added to the HTTP request.
730 731 732 733 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 730 def list(resource_group_name, custom_headers = nil) response = list_async(resource_group_name, custom_headers).value! response.body unless response.nil? end |
#list_all(custom_headers = nil) ⇒ VirtualMachineListResult
Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines.
will be added to the HTTP request.
821 822 823 824 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 821 def list_all(custom_headers = nil) response = list_all_async(custom_headers).value! response.body unless response.nil? end |
#list_all_async(custom_headers = nil) ⇒ Concurrent::Promise
Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines.
to the HTTP request.
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 850 def list_all_async(custom_headers = nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachineListResult.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_all_next(next_page_link, custom_headers = nil) ⇒ VirtualMachineListResult
Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines.
call to List operation. will be added to the HTTP request.
1432 1433 1434 1435 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1432 def list_all_next(next_page_link, custom_headers = nil) response = list_all_next_async(next_page_link, custom_headers).value! response.body unless response.nil? end |
#list_all_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise
Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines.
call to List operation. to the HTTP request.
1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1465 def list_all_next_async(next_page_link, custom_headers = nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachineListResult.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_all_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines.
call to List operation. will be added to the HTTP request.
1449 1450 1451 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1449 def list_all_next_with_http_info(next_page_link, custom_headers = nil) list_all_next_async(next_page_link, custom_headers).value! end |
#list_all_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Gets the list of Virtual Machines in the subscription. Use nextLink property in the response to get the next page of Virtual Machines. Do this till nextLink is not null to fetch all the Virtual Machines.
will be added to the HTTP request.
836 837 838 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 836 def list_all_with_http_info(custom_headers = nil) list_all_async(custom_headers).value! end |
#list_async(resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to list virtual machines under a resource group.
to the HTTP request.
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 757 def list_async(resource_group_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachineListResult.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_available_sizes(resource_group_name, vm_name, custom_headers = nil) ⇒ VirtualMachineSizeListResult
Lists all available virtual machine sizes it can be resized to for a virtual machine.
will be added to the HTTP request.
914 915 916 917 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 914 def list_available_sizes(resource_group_name, vm_name, custom_headers = nil) response = list_available_sizes_async(resource_group_name, vm_name, custom_headers).value! response.body unless response.nil? end |
#list_available_sizes_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
Lists all available virtual machine sizes it can be resized to for a virtual machine.
to the HTTP request.
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 945 def list_available_sizes_async(resource_group_name, vm_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_name is nil' if vm_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes' = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmName' => vm_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, ) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = VirtualMachineSizeListResult.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e., e.backtrace, result) end end result end promise.execute end |
#list_available_sizes_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
Lists all available virtual machine sizes it can be resized to for a virtual machine.
will be added to the HTTP request.
930 931 932 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 930 def list_available_sizes_with_http_info(resource_group_name, vm_name, custom_headers = nil) list_available_sizes_async(resource_group_name, vm_name, custom_headers).value! end |
#list_with_http_info(resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse
The operation to list virtual machines under a resource group.
will be added to the HTTP request.
744 745 746 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 744 def list_with_http_info(resource_group_name, custom_headers = nil) list_async(resource_group_name, custom_headers).value! end |
#power_off(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to power off (stop) a virtual machine.
response.
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1008 def power_off(resource_group_name, vm_name, custom_headers = nil) # Send request promise = begin_power_off_async(resource_group_name, vm_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |
#redeploy(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to redeploy a virtual machine.
response.
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1323 def redeploy(resource_group_name, vm_name, custom_headers = nil) # Send request promise = begin_redeploy_async(resource_group_name, vm_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |
#restart(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to restart a virtual machine.
response.
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1113 def restart(resource_group_name, vm_name, custom_headers = nil) # Send request promise = begin_restart_async(resource_group_name, vm_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |
#start(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise
The operation to start a virtual machine.
response.
1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 |
# File 'lib/azure_mgmt_compute/virtual_machines.rb', line 1218 def start(resource_group_name, vm_name, custom_headers = nil) # Send request promise = begin_start_async(resource_group_name, vm_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end |