Class: Azure::ARM::Compute::VirtualMachines

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_compute/virtual_machines.rb

Overview

The Compute Management Client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ VirtualMachines

Creates and initializes a new instance of the VirtualMachines class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientComputeManagementClient (readonly)

Returns reference to the ComputeManagementClient.

Returns:



23
24
25
# File 'lib/generated/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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



85
86
87
88
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 85

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 120

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

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = VirtualMachineCaptureParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters, 'parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'
  options = {
      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, options)
  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)
        result_mapper = VirtualMachineCaptureResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



103
104
105
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 103

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



243
244
245
246
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 243

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 276

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

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = VirtualMachine.mapper()
  request_content = @client.serialize(request_mapper,  parameters, 'parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'
  options = {
      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, options)
  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)
        result_mapper = VirtualMachine.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = VirtualMachine.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



260
261
262
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 260

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



621
622
623
624
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 621

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 652

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'
  options = {
      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, options)
  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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



637
638
639
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 637

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



398
399
400
401
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 398

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 427

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}'
  options = {
      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, options)
  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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



413
414
415
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 413

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1149
1150
1151
1152
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1149

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1178

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'
  options = {
      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, options)
  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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1164
1165
1166
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1164

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1512
1513
1514
1515
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1512

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1541

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'
  options = {
      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, options)
  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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1527
1528
1529
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1527

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1270
1271
1272
1273
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1270

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1299

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'
  options = {
      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, options)
  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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1285
1286
1287
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1285

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1391
1392
1393
1394
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1391

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1420

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'
  options = {
      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, options)
  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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1406
1407
1408
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1406

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) ⇒ 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



38
39
40
41
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 38

def capture(resource_group_name, vm_name, parameters, custom_headers = nil)
  response = capture_async(resource_group_name, vm_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#capture_async(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

the Capture Virtual Machine operation. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 54

def capture_async(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|
      result_mapper = VirtualMachineCaptureResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    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) ⇒ VirtualMachine

The operation to create or update a virtual machine.

Machine operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



197
198
199
200
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 197

def create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil)
  response = create_or_update_async(resource_group_name, vm_name, parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Machine operation. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 213

def create_or_update_async(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|
      result_mapper = VirtualMachine.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    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) ⇒ 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



581
582
583
584
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 581

def deallocate(resource_group_name, vm_name, custom_headers = nil)
  response = deallocate_async(resource_group_name, vm_name, custom_headers).value!
  nil
end

#deallocate_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 595

def deallocate_async(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) ⇒ Object

The operation to delete a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



359
360
361
362
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 359

def delete(resource_group_name, vm_name, custom_headers = nil)
  response = delete_async(resource_group_name, vm_name, custom_headers).value!
  nil
end

#delete_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 373

def delete_async(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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



706
707
708
709
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 706

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 735

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'
  options = {
      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, options)
  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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



721
722
723
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 721

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • expand (InstanceViewTypes) (defaults to: nil)

    The expand expression to apply on the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



484
485
486
487
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 484

def get(resource_group_name, vm_name, expand = nil, custom_headers = nil)
  response = get_async(resource_group_name, vm_name, expand, 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • expand (InstanceViewTypes) (defaults to: nil)

    The expand expression to apply on the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 517

def get_async(resource_group_name, vm_name, expand = 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}'
  options = {
      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' => 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, options)
  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)
        result_mapper = VirtualMachine.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • expand (InstanceViewTypes) (defaults to: nil)

    The expand expression to apply on the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



501
502
503
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 501

def get_with_http_info(resource_group_name, vm_name, expand = nil, custom_headers = nil)
  get_async(resource_group_name, vm_name, expand, custom_headers).value!
end

#list(resource_group_name, custom_headers = nil) ⇒ Array<VirtualMachine>

The operation to list virtual machines under a resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



810
811
812
813
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 810

def list(resource_group_name, custom_headers = nil)
  first_page = list_as_lazy(resource_group_name, custom_headers)
  first_page.get_all_items
end

#list_all(custom_headers = nil) ⇒ Array<VirtualMachine>

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.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



923
924
925
926
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 923

def list_all(custom_headers = nil)
  first_page = list_all_as_lazy(custom_headers)
  first_page.get_all_items
end

#list_all_as_lazy(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.

response.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



902
903
904
905
906
907
908
909
910
911
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 902

def list_all_as_lazy(custom_headers = nil)
  response = list_all_async(custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_all_next_async(next_link, custom_headers)
    end
    page
  end
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.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
999
1000
1001
1002
1003
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 952

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'
  options = {
      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, options)
  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)
        result_mapper = VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, 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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1688
1689
1690
1691
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1688

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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1721

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}'
  options = {
      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, options)
  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)
        result_mapper = VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, 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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1705
1706
1707
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1705

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.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



938
939
940
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 938

def list_all_with_http_info(custom_headers = nil)
  list_all_async(custom_headers).value!
end

#list_as_lazy(resource_group_name, custom_headers = nil) ⇒ VirtualMachineListResult

The operation to list virtual machines under a resource group.

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



790
791
792
793
794
795
796
797
798
799
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 790

def list_as_lazy(resource_group_name, custom_headers = nil)
  response = list_async(resource_group_name, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_link|
      list_next_async(next_link, custom_headers)
    end
    page
  end
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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



837
838
839
840
841
842
843
844
845
846
847
848
849
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
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 837

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'
  options = {
      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, options)
  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)
        result_mapper = VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1016
1017
1018
1019
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1016

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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
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
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1047

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'
  options = {
      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, options)
  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)
        result_mapper = VirtualMachineSizeListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1032
1033
1034
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1032

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_next(next_page_link, custom_headers = nil) ⇒ VirtualMachineListResult

The operation to list virtual machines under a resource group.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



1596
1597
1598
1599
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1596

def list_next(next_page_link, custom_headers = nil)
  response = list_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

The operation to list virtual machines under a resource group.

call to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1625

def list_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}'
  options = {
      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, options)
  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)
        result_mapper = VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to list virtual machines under a resource group.

call to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1611
1612
1613
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1611

def list_next_with_http_info(next_page_link, custom_headers = nil)
  list_next_async(next_page_link, 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.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



824
825
826
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 824

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) ⇒ Object

The operation to power off (stop) a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1110
1111
1112
1113
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1110

def power_off(resource_group_name, vm_name, custom_headers = nil)
  response = power_off_async(resource_group_name, vm_name, custom_headers).value!
  nil
end

#power_off_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1124

def power_off_async(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) ⇒ Object

The operation to redeploy a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1473
1474
1475
1476
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1473

def redeploy(resource_group_name, vm_name, custom_headers = nil)
  response = redeploy_async(resource_group_name, vm_name, custom_headers).value!
  nil
end

#redeploy_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1487

def redeploy_async(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) ⇒ Object

The operation to restart a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1231
1232
1233
1234
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1231

def restart(resource_group_name, vm_name, custom_headers = nil)
  response = restart_async(resource_group_name, vm_name, custom_headers).value!
  nil
end

#restart_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1245

def restart_async(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) ⇒ Object

The operation to start a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



1352
1353
1354
1355
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1352

def start(resource_group_name, vm_name, custom_headers = nil)
  response = start_async(resource_group_name, vm_name, custom_headers).value!
  nil
end

#start_async(resource_group_name, vm_name, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
# File 'lib/generated/azure_mgmt_compute/virtual_machines.rb', line 1366

def start_async(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