Class: Azure::Compute::Mgmt::V2020_12_01::VirtualMachines

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb

Overview

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



17
18
19
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientComputeManagementClient (readonly)

Returns reference to the ComputeManagementClient.

Returns:



22
23
24
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 22

def client
  @client
end

Instance Method Details

#assess_patches(resource_group_name, vm_name, custom_headers: nil) ⇒ VirtualMachineAssessPatchesResult

Assess patches on the VM.

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:

  • (VirtualMachineAssessPatchesResult)

    operation results.



1445
1446
1447
1448
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1445

def assess_patches(resource_group_name, vm_name, custom_headers:nil)
  response = assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#assess_patches_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



1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1459

def assess_patches_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineAssessPatchesResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
  end

  promise
end

#begin_assess_patches(resource_group_name, vm_name, custom_headers: nil) ⇒ VirtualMachineAssessPatchesResult

Assess patches on the VM.

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:

  • (VirtualMachineAssessPatchesResult)

    operation results.



2798
2799
2800
2801
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2798

def begin_assess_patches(resource_group_name, vm_name, custom_headers:nil)
  response = begin_assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Assess patches on the VM.

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.



2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2827

def begin_assess_patches_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}/assessPatches'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineAssessPatchesResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_assess_patches_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Assess patches on the VM.

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.



2813
2814
2815
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2813

def begin_assess_patches_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_assess_patches_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#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:

  • (VirtualMachineCaptureResult)

    operation results.



1582
1583
1584
1585
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1582

def begin_capture(resource_group_name, vm_name, parameters, custom_headers:nil)
  response = begin_capture_async(resource_group_name, vm_name, parameters, custom_headers: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.



1617
1618
1619
1620
1621
1622
1623
1624
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
1675
1676
1677
1678
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1617

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineCaptureParameters.mapper()
  request_content = @client.serialize(request_mapper,  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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineCaptureResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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.



1600
1601
1602
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1600

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:custom_headers).value!
end

#begin_convert_to_managed_disks(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this 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.

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

    A hash of custom headers that



2008
2009
2010
2011
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2008

def begin_convert_to_managed_disks(resource_group_name, vm_name, custom_headers:nil)
  response = begin_convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

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

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this 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.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2039

def begin_convert_to_managed_disks_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}/convertToManagedDisks'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_convert_to_managed_disks_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this 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.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2024
2025
2026
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2024

def begin_convert_to_managed_disks_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers: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. Please note some properties can be set only during virtual machine creation.

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:

  • (VirtualMachine)

    operation results.



1693
1694
1695
1696
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1693

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: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. Please note some properties can be set only during virtual machine creation.

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.



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
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1728

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
  request_content = @client.serialize(request_mapper,  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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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. Please note some properties can be set only during virtual machine creation.

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.



1711
1712
1713
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1711

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



2094
2095
2096
2097
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2094

def begin_deallocate(resource_group_name, vm_name, custom_headers:nil)
  response = begin_deallocate_async(resource_group_name, vm_name, custom_headers: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.



2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2125

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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.



2110
2111
2112
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2110

def begin_deallocate_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_deallocate_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, vm_name, force_deletion: nil, custom_headers: nil) ⇒ Object

The operation to delete a virtual machine.

machines.(Feature in Preview) 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.

  • force_deletion (Boolean) (defaults to: nil)

    Optional parameter to force delete virtual

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

    A hash of custom headers that



1920
1921
1922
1923
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1920

def begin_delete(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
  response = begin_delete_async(resource_group_name, vm_name, force_deletion:force_deletion, custom_headers:custom_headers).value!
  nil
end

#begin_delete_async(resource_group_name, vm_name, force_deletion: nil, custom_headers: nil) ⇒ Concurrent::Promise

The operation to delete a virtual machine.

machines.(Feature in Preview) to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • force_deletion (Boolean) (defaults to: nil)

    Optional parameter to force delete virtual

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1953

def begin_delete_async(resource_group_name, vm_name, force_deletion: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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}'

  request_url = @base_url || @client.base_url

  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: {'forceDeletion' => force_deletion,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_delete_with_http_info(resource_group_name, vm_name, force_deletion: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to delete a virtual machine.

machines.(Feature in Preview) 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.

  • force_deletion (Boolean) (defaults to: nil)

    Optional parameter to force delete virtual

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1937
1938
1939
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1937

def begin_delete_with_http_info(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
  begin_delete_async(resource_group_name, vm_name, force_deletion:force_deletion, custom_headers:custom_headers).value!
end

#begin_install_patches(resource_group_name, vm_name, install_patches_input, custom_headers: nil) ⇒ VirtualMachineInstallPatchesResult

Installs patches on the VM.

for InstallPatches as directly received by the API 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.

  • install_patches_input (VirtualMachineInstallPatchesParameters)

    Input

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

    A hash of custom headers that

Returns:

  • (VirtualMachineInstallPatchesResult)

    operation results.



2894
2895
2896
2897
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2894

def begin_install_patches(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
  response = begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers: nil) ⇒ Concurrent::Promise

Installs patches on the VM.

for InstallPatches as directly received by the API to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • install_patches_input (VirtualMachineInstallPatchesParameters)

    Input

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2927

def begin_install_patches_async(resource_group_name, vm_name, install_patches_input, 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, 'install_patches_input is nil' if install_patches_input.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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstallPatchesParameters.mapper()
  request_content = @client.serialize(request_mapper,  install_patches_input)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstallPatchesResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_install_patches_with_http_info(resource_group_name, vm_name, install_patches_input, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Installs patches on the VM.

for InstallPatches as directly received by the API 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.

  • install_patches_input (VirtualMachineInstallPatchesParameters)

    Input

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2911
2912
2913
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2911

def begin_install_patches_with_http_info(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
  begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers).value!
end

#begin_perform_maintenance(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

The operation to perform maintenance on 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



2714
2715
2716
2717
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2714

def begin_perform_maintenance(resource_group_name, vm_name, custom_headers:nil)
  response = begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

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

The operation to perform maintenance on 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.



2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2743

def begin_perform_maintenance_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}/performMaintenance'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_perform_maintenance_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to perform maintenance on 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.



2729
2730
2731
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2729

def begin_perform_maintenance_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#begin_power_off(resource_group_name, vm_name, skip_shutdown: false, custom_headers: nil) ⇒ Object

The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.

shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified 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.

  • skip_shutdown (Boolean) (defaults to: false)

    The parameter to request non-graceful VM

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

    A hash of custom headers that



2185
2186
2187
2188
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2185

def begin_power_off(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
  response = begin_power_off_async(resource_group_name, vm_name, skip_shutdown:skip_shutdown, custom_headers:custom_headers).value!
  nil
end

#begin_power_off_async(resource_group_name, vm_name, skip_shutdown: false, custom_headers: nil) ⇒ Concurrent::Promise

The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.

shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • skip_shutdown (Boolean) (defaults to: false)

    The parameter to request non-graceful VM

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2226

def begin_power_off_async(resource_group_name, vm_name, skip_shutdown:false, 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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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: {'skipShutdown' => skip_shutdown,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_power_off_with_http_info(resource_group_name, vm_name, skip_shutdown: false, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.

shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified 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.

  • skip_shutdown (Boolean) (defaults to: false)

    The parameter to request non-graceful VM

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2206
2207
2208
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2206

def begin_power_off_with_http_info(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
  begin_power_off_async(resource_group_name, vm_name, skip_shutdown:skip_shutdown, custom_headers:custom_headers).value!
end

#begin_reapply(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

The operation to reapply a virtual machine's state.

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



2280
2281
2282
2283
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2280

def begin_reapply(resource_group_name, vm_name, custom_headers:nil)
  response = begin_reapply_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

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

The operation to reapply a virtual machine's state.

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.



2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2309

def begin_reapply_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}/reapply'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_reapply_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to reapply a virtual machine's state.

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.



2295
2296
2297
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2295

def begin_reapply_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_reapply_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#begin_redeploy(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

Shuts down the virtual machine, moves it to a new node, and powers it back on.

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



2530
2531
2532
2533
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2530

def begin_redeploy(resource_group_name, vm_name, custom_headers:nil)
  response = begin_redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

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

Shuts down the virtual machine, moves it to a new node, and powers it back on.

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.



2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2561

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_redeploy_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Shuts down the virtual machine, moves it to a new node, and powers it back on.

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.



2546
2547
2548
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2546

def begin_redeploy_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_redeploy_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#begin_reimage(resource_group_name, vm_name, parameters: nil, custom_headers: nil) ⇒ Object

Reimages the virtual machine which has an ephemeral OS disk back to its initial state.

the Reimage 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 (VirtualMachineReimageParameters) (defaults to: nil)

    Parameters supplied to

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

    A hash of custom headers that



2618
2619
2620
2621
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2618

def begin_reimage(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
  response = begin_reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

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

Reimages the virtual machine which has an ephemeral OS disk back to its initial state.

the Reimage 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 (VirtualMachineReimageParameters) (defaults to: nil)

    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.



2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2653

def begin_reimage_async(resource_group_name, vm_name, parameters: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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineReimageParameters.mapper()
  request_content = @client.serialize(request_mapper,  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}/reimage'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_reimage_with_http_info(resource_group_name, vm_name, parameters: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Reimages the virtual machine which has an ephemeral OS disk back to its initial state.

the Reimage 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 (VirtualMachineReimageParameters) (defaults to: nil)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



2636
2637
2638
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2636

def begin_reimage_with_http_info(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
  begin_reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers: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



2363
2364
2365
2366
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2363

def begin_restart(resource_group_name, vm_name, custom_headers:nil)
  response = begin_restart_async(resource_group_name, vm_name, custom_headers: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.



2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2392

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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.



2378
2379
2380
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2378

def begin_restart_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_restart_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#begin_run_command(resource_group_name, vm_name, parameters, custom_headers: nil) ⇒ RunCommandResult

Run command on the VM.

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 (RunCommandInput)

    Parameters supplied to the Run command

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

    A hash of custom headers that

Returns:

  • (RunCommandResult)

    operation results.



3002
3003
3004
3005
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3002

def begin_run_command(resource_group_name, vm_name, parameters, custom_headers:nil)
  response = begin_run_command_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Run command on the VM.

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 (RunCommandInput)

    Parameters supplied to the Run command

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3035

def begin_run_command_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RunCommandInput.mapper()
  request_content = @client.serialize(request_mapper,  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}/runCommand'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RunCommandResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_run_command_with_http_info(resource_group_name, vm_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Run command on the VM.

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 (RunCommandInput)

    Parameters supplied to the Run command

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3019
3020
3021
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3019

def begin_run_command_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
  begin_run_command_async(resource_group_name, vm_name, parameters, custom_headers: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



2446
2447
2448
2449
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2446

def begin_start(resource_group_name, vm_name, custom_headers:nil)
  response = begin_start_async(resource_group_name, vm_name, custom_headers: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.



2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2475

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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.



2461
2462
2463
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 2461

def begin_start_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  begin_start_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#begin_update(resource_group_name, vm_name, parameters, custom_headers: nil) ⇒ VirtualMachine

The operation to update a virtual machine.

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 (VirtualMachineUpdate)

    Parameters supplied to the Update

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

    A hash of custom headers that

Returns:

  • (VirtualMachine)

    operation results.



1813
1814
1815
1816
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1813

def begin_update(resource_group_name, vm_name, parameters, custom_headers:nil)
  response = begin_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

The operation to update a virtual machine.

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 (VirtualMachineUpdate)

    Parameters supplied to the Update

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1846

def begin_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineUpdate.mapper()
  request_content = @client.serialize(request_mapper,  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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to update a virtual machine.

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 (VirtualMachineUpdate)

    Parameters supplied to the Update

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1830
1831
1832
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1830

def begin_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers:nil)
  begin_update_async(resource_group_name, vm_name, parameters, custom_headers: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:

  • (VirtualMachineCaptureResult)

    operation results.



134
135
136
137
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 134

def capture(resource_group_name, vm_name, parameters, custom_headers:nil)
  response = capture_async(resource_group_name, vm_name, parameters, custom_headers: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



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 150

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:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineCaptureResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
  end

  promise
end

#convert_to_managed_disks(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this 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.

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

    A hash of custom headers that



509
510
511
512
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 509

def convert_to_managed_disks(resource_group_name, vm_name, custom_headers:nil)
  response = convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

#convert_to_managed_disks_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



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 523

def convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_convert_to_managed_disks_async(resource_group_name, vm_name, custom_headers: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

#create_or_update(resource_group_name, vm_name, parameters, custom_headers: nil) ⇒ VirtualMachine

The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.

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:

  • (VirtualMachine)

    operation results.



181
182
183
184
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 181

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



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 197

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:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
      parsed_response = @client.deserialize(result_mapper, 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



548
549
550
551
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 548

def deallocate(resource_group_name, vm_name, custom_headers:nil)
  response = deallocate_async(resource_group_name, vm_name, custom_headers: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



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 562

def deallocate_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_deallocate_async(resource_group_name, vm_name, custom_headers: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, force_deletion: nil, custom_headers: nil) ⇒ Object

The operation to delete a virtual machine.

machines.(Feature in Preview) 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.

  • force_deletion (Boolean) (defaults to: nil)

    Optional parameter to force delete virtual

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

    A hash of custom headers that



271
272
273
274
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 271

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

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

machines.(Feature in Preview) 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.

  • force_deletion (Boolean) (defaults to: nil)

    Optional parameter to force delete 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



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 287

def delete_async(resource_group_name, vm_name, force_deletion:nil, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, vm_name, force_deletion:force_deletion, custom_headers: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 OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).

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



592
593
594
595
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 592

def generalize(resource_group_name, vm_name, custom_headers:nil)
  response = generalize_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

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

Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).

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.



631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 631

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#generalize_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation.
For Windows, please refer to [Create a managed image of a generalized VM in Azure](docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).

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.



612
613
614
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 612

def generalize_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  generalize_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

#get(resource_group_name, vm_name, expand: nil, custom_headers: nil) ⇒ VirtualMachine

Retrieves information about the model view or the instance view of 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:

  • (VirtualMachine)

    operation results.



316
317
318
319
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 316

def get(resource_group_name, vm_name, expand:nil, custom_headers:nil)
  response = get_async(resource_group_name, vm_name, expand:expand, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, vm_name, expand: nil, custom_headers: nil) ⇒ Concurrent::Promise

Retrieves information about the model view or the instance view of 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.



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 351

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

Retrieves information about the model view or the instance view of 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.



334
335
336
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 334

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

#install_patches(resource_group_name, vm_name, install_patches_input, custom_headers: nil) ⇒ VirtualMachineInstallPatchesResult

Installs patches on the VM.

for InstallPatches as directly received by the API 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.

  • install_patches_input (VirtualMachineInstallPatchesParameters)

    Input

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

    A hash of custom headers that

Returns:

  • (VirtualMachineInstallPatchesResult)

    operation results.



1489
1490
1491
1492
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1489

def install_patches(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
  response = install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers: nil) ⇒ Concurrent::Promise

for InstallPatches as directly received by the API 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.

  • install_patches_input (VirtualMachineInstallPatchesParameters)

    Input

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1505

def install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:nil)
  # Send request
  promise = begin_install_patches_async(resource_group_name, vm_name, install_patches_input, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstallPatchesResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
  end

  promise
end

#instance_view(resource_group_name, vm_name, custom_headers: nil) ⇒ VirtualMachineInstanceView

Retrieves information about the run-time state of 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:

  • (VirtualMachineInstanceView)

    operation results.



416
417
418
419
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 416

def instance_view(resource_group_name, vm_name, custom_headers:nil)
  response = instance_view_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

Retrieves information about the run-time state of 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.



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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 445

def instance_view_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}/instanceView'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineInstanceView.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

#instance_view_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Retrieves information about the run-time state of 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.



431
432
433
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 431

def instance_view_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  instance_view_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
end

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

Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.

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:

  • (Array<VirtualMachine>)

    operation results.



686
687
688
689
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 686

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

#list_all(status_only: nil, custom_headers: nil) ⇒ Array<VirtualMachine>

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

of all Virtual Machines in the subscription. will be added to the HTTP request.

Parameters:

  • status_only (String) (defaults to: nil)

    statusOnly=true enables fetching run time status

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

    A hash of custom headers that

Returns:

  • (Array<VirtualMachine>)

    operation results.



780
781
782
783
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 780

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

#list_all_as_lazy(status_only: nil, custom_headers: nil) ⇒ VirtualMachineListResult

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

of all Virtual Machines in the subscription. will be added to the HTTP request.

response.

Parameters:

  • status_only (String) (defaults to: nil)

    statusOnly=true enables fetching run time status

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

    A hash of custom headers that

Returns:

  • (VirtualMachineListResult)

    which provide lazy access to pages of the



3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3434

def list_all_as_lazy(status_only:nil, custom_headers:nil)
  response = list_all_async(status_only:status_only, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_all_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_all_async(status_only: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

of all Virtual Machines in the subscription. to the HTTP request.

Parameters:

  • status_only (String) (defaults to: nil)

    statusOnly=true enables fetching run time status

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
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
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 811

def list_all_async(status_only:nil, 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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version,'statusOnly' => status_only},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (VirtualMachineListResult)

    operation results.



3295
3296
3297
3298
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3295

def list_all_next(next_page_link, custom_headers:nil)
  response = list_all_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_all_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3326

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3311
3312
3313
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3311

def list_all_next_with_http_info(next_page_link, custom_headers:nil)
  list_all_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_all_with_http_info(status_only: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines.

of all Virtual Machines in the subscription. will be added to the HTTP request.

Parameters:

  • status_only (String) (defaults to: nil)

    statusOnly=true enables fetching run time status

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



796
797
798
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 796

def list_all_with_http_info(status_only:nil, custom_headers:nil)
  list_all_async(status_only:status_only, custom_headers:custom_headers).value!
end

#list_as_lazy(resource_group_name, custom_headers: nil) ⇒ VirtualMachineListResult

Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.

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:

  • (VirtualMachineListResult)

    which provide lazy access to pages of the



3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3411

def list_as_lazy(resource_group_name, custom_headers:nil)
  response = list_async(resource_group_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.

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.



715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
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
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 715

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 to which the specified virtual machine can be resized.

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:

  • (VirtualMachineSizeListResult)

    operation results.



875
876
877
878
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 875

def list_available_sizes(resource_group_name, vm_name, custom_headers:nil)
  response = list_available_sizes_async(resource_group_name, vm_name, custom_headers: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 to which the specified virtual machine can be resized.

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.



906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 906

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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineSizeListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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 to which the specified virtual machine can be resized.

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.



891
892
893
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 891

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:custom_headers).value!
end

#list_by_location(location, custom_headers: nil) ⇒ Array<VirtualMachine>

Gets all the virtual machines under the specified subscription for the specified location.

subscription are queried. will be added to the HTTP request.

Parameters:

  • location (String)

    The location for which virtual machines under the

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

    A hash of custom headers that

Returns:

  • (Array<VirtualMachine>)

    operation results.



35
36
37
38
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 35

def list_by_location(location, custom_headers:nil)
  first_page = list_by_location_as_lazy(location, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_location_as_lazy(location, custom_headers: nil) ⇒ VirtualMachineListResult

Gets all the virtual machines under the specified subscription for the specified location.

subscription are queried. will be added to the HTTP request.

response.

Parameters:

  • location (String)

    The location for which virtual machines under the

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

    A hash of custom headers that

Returns:

  • (VirtualMachineListResult)

    which provide lazy access to pages of the



3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3389

def list_by_location_as_lazy(location, custom_headers:nil)
  response = list_by_location_async(location, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_location_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_location_async(location, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the virtual machines under the specified subscription for the specified location.

subscription are queried. to the HTTP request.

Parameters:

  • location (String)

    The location for which virtual machines under the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 66

def list_by_location_async(location, custom_headers:nil)
  fail ArgumentError, 'location is nil' if location.nil?
  fail ArgumentError, "'location' should satisfy the constraint - 'Pattern': '^[-\w\._]+$'" if !location.nil? && location.match(Regexp.new('^^[-\w\._]+$$')).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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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/locations/{location}/virtualMachines'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'location' => location,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_by_location_next(next_page_link, custom_headers: nil) ⇒ VirtualMachineListResult

Gets all the virtual machines under the specified subscription for the specified location.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (VirtualMachineListResult)

    operation results.



3109
3110
3111
3112
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3109

def list_by_location_next(next_page_link, custom_headers:nil)
  response = list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_location_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the virtual machines under the specified subscription for the specified location.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3140

def list_by_location_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

  # 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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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_by_location_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the virtual machines under the specified subscription for the specified location.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3125
3126
3127
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3125

def list_by_location_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_location_with_http_info(location, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the virtual machines under the specified subscription for the specified location.

subscription are queried. will be added to the HTTP request.

Parameters:

  • location (String)

    The location for which virtual machines under the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



51
52
53
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 51

def list_by_location_with_http_info(location, custom_headers:nil)
  list_by_location_async(location, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ VirtualMachineListResult

Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (VirtualMachineListResult)

    operation results.



3202
3203
3204
3205
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3202

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

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

Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3233

def list_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

  # 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}'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachineListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



3218
3219
3220
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 3218

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines.

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.



701
702
703
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 701

def list_with_http_info(resource_group_name, custom_headers:nil)
  list_async(resource_group_name, custom_headers:custom_headers).value!
end

#perform_maintenance(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

The operation to perform maintenance on 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



1322
1323
1324
1325
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1322

def perform_maintenance(resource_group_name, vm_name, custom_headers:nil)
  response = perform_maintenance_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

#perform_maintenance_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



1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1336

def perform_maintenance_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers: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

#power_off(resource_group_name, vm_name, skip_shutdown: false, custom_headers: nil) ⇒ Object

The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this virtual machine.

shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified 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.

  • skip_shutdown (Boolean) (defaults to: false)

    The parameter to request non-graceful VM

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

    A hash of custom headers that



975
976
977
978
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 975

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

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

shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified 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.

  • skip_shutdown (Boolean) (defaults to: false)

    The parameter to request non-graceful VM

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 993

def power_off_async(resource_group_name, vm_name, skip_shutdown:false, custom_headers:nil)
  # Send request
  promise = begin_power_off_async(resource_group_name, vm_name, skip_shutdown:skip_shutdown, custom_headers: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

#reapply(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

The operation to reapply a virtual machine's state.

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



1017
1018
1019
1020
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1017

def reapply(resource_group_name, vm_name, custom_headers:nil)
  response = reapply_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

#reapply_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



1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1031

def reapply_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_reapply_async(resource_group_name, vm_name, custom_headers: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

Shuts down the virtual machine, moves it to a new node, and powers it back on.

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



1132
1133
1134
1135
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1132

def redeploy(resource_group_name, vm_name, custom_headers:nil)
  response = redeploy_async(resource_group_name, vm_name, custom_headers: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



1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1146

def redeploy_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_redeploy_async(resource_group_name, vm_name, custom_headers: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

#reimage(resource_group_name, vm_name, parameters: nil, custom_headers: nil) ⇒ Object

Reimages the virtual machine which has an ephemeral OS disk back to its initial state.

the Reimage 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 (VirtualMachineReimageParameters) (defaults to: nil)

    Parameters supplied to

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

    A hash of custom headers that



1173
1174
1175
1176
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1173

def reimage(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
  response = reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

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

the Reimage 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 (VirtualMachineReimageParameters) (defaults to: nil)

    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



1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1189

def reimage_async(resource_group_name, vm_name, parameters:nil, custom_headers:nil)
  # Send request
  promise = begin_reimage_async(resource_group_name, vm_name, parameters:parameters, custom_headers: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



1055
1056
1057
1058
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1055

def restart(resource_group_name, vm_name, custom_headers:nil)
  response = restart_async(resource_group_name, vm_name, custom_headers: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



1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1069

def restart_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_restart_async(resource_group_name, vm_name, custom_headers: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

#retrieve_boot_diagnostics_data(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes: nil, custom_headers: nil) ⇒ RetrieveBootDiagnosticsDataResult

The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.

minutes for the SAS URIs with a value between 1 to 1440 minutes.
NOTE: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes. 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.

  • sas_uri_expiration_time_in_minutes (Integer) (defaults to: nil)

    Expiration duration in

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

    A hash of custom headers that

Returns:

  • (RetrieveBootDiagnosticsDataResult)

    operation results.



1220
1221
1222
1223
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1220

def retrieve_boot_diagnostics_data(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:nil, custom_headers:nil)
  response = retrieve_boot_diagnostics_data_async(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:sas_uri_expiration_time_in_minutes, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#retrieve_boot_diagnostics_data_async(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes: nil, custom_headers: nil) ⇒ Concurrent::Promise

The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.

minutes for the SAS URIs with a value between 1 to 1440 minutes.
NOTE: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • sas_uri_expiration_time_in_minutes (Integer) (defaults to: nil)

    Expiration duration in

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
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
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1259

def retrieve_boot_diagnostics_data_async(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes: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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}/retrieveBootDiagnosticsData'

  request_url = @base_url || @client.base_url

  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: {'sasUriExpirationTimeInMinutes' => sas_uri_expiration_time_in_minutes,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.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(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RetrieveBootDiagnosticsDataResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      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

#retrieve_boot_diagnostics_data_with_http_info(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs.

minutes for the SAS URIs with a value between 1 to 1440 minutes.
NOTE: If not specified, SAS URIs will be generated with a default expiration duration of 120 minutes. 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.

  • sas_uri_expiration_time_in_minutes (Integer) (defaults to: nil)

    Expiration duration in

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1240
1241
1242
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1240

def retrieve_boot_diagnostics_data_with_http_info(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:nil, custom_headers:nil)
  retrieve_boot_diagnostics_data_async(resource_group_name, vm_name, sas_uri_expiration_time_in_minutes:sas_uri_expiration_time_in_minutes, custom_headers:custom_headers).value!
end

#run_command(resource_group_name, vm_name, parameters, custom_headers: nil) ⇒ RunCommandResult

Run command on the VM.

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 (RunCommandInput)

    Parameters supplied to the Run command

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

    A hash of custom headers that

Returns:

  • (RunCommandResult)

    operation results.



1535
1536
1537
1538
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1535

def run_command(resource_group_name, vm_name, parameters, custom_headers:nil)
  response = run_command_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

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 (RunCommandInput)

    Parameters supplied to the Run command

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1551

def run_command_async(resource_group_name, vm_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_run_command_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::RunCommandResult.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
  end

  promise
end

#simulate_eviction(resource_group_name, vm_name, custom_headers: nil) ⇒ Object

The operation to simulate the eviction of spot 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



1361
1362
1363
1364
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1361

def simulate_eviction(resource_group_name, vm_name, custom_headers:nil)
  response = simulate_eviction_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
  nil
end

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

The operation to simulate the eviction of spot 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.



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
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1390

def simulate_eviction_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # 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}/simulateEviction'

  request_url = @base_url || @client.base_url

  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 || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#simulate_eviction_with_http_info(resource_group_name, vm_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to simulate the eviction of spot 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.



1376
1377
1378
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1376

def simulate_eviction_with_http_info(resource_group_name, vm_name, custom_headers:nil)
  simulate_eviction_async(resource_group_name, vm_name, custom_headers:custom_headers).value!
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



1093
1094
1095
1096
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1093

def start(resource_group_name, vm_name, custom_headers:nil)
  response = start_async(resource_group_name, vm_name, custom_headers: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



1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 1107

def start_async(resource_group_name, vm_name, custom_headers:nil)
  # Send request
  promise = begin_start_async(resource_group_name, vm_name, custom_headers: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

#update(resource_group_name, vm_name, parameters, custom_headers: nil) ⇒ VirtualMachine

The operation to update a virtual machine.

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 (VirtualMachineUpdate)

    Parameters supplied to the Update

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

    A hash of custom headers that

Returns:

  • (VirtualMachine)

    operation results.



227
228
229
230
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 227

def update(resource_group_name, vm_name, parameters, custom_headers:nil)
  response = update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

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

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 (VirtualMachineUpdate)

    Parameters supplied to the Update

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/2020-12-01/generated/azure_mgmt_compute/virtual_machines.rb', line 243

def update_async(resource_group_name, vm_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, vm_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2020_12_01::Models::VirtualMachine.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end