Class: Azure::ARM::DevTestLabs::VirtualMachines

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

Overview

The DevTest Labs 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/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientDevTestLabsClient (readonly)

Returns reference to the DevTestLabsClient.

Returns:



22
23
24
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 22

def client
  @client
end

Instance Method Details

#add_data_disk(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil) ⇒ Object

Attach a new or existing data disk to virtual machine. This operation can take a while to complete.

new or existing data disk to a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • data_disk_properties (DataDiskProperties)

    Request body for adding a

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

    A hash of custom headers that



444
445
446
447
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 444

def add_data_disk(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
  response = add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers).value!
  nil
end

#add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil) ⇒ Concurrent::Promise

new or existing data disk to a virtual machine. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • data_disk_properties (DataDiskProperties)

    Request body for adding a

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 461

def add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
  # Send request
  promise = begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, 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

#apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil) ⇒ Object

Apply artifacts to virtual machine. This operation can take a while to complete.

applying artifacts to a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • apply_artifacts_request (ApplyArtifactsRequest)

    Request body for

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

    A hash of custom headers that



489
490
491
492
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 489

def apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
  response = apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
  nil
end

#apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil) ⇒ Concurrent::Promise

applying artifacts to a virtual machine. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • apply_artifacts_request (ApplyArtifactsRequest)

    Request body for

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 506

def apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
  # Send request
  promise = begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, 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

#begin_add_data_disk(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil) ⇒ Object

Attach a new or existing data disk to virtual machine. This operation can take a while to complete.

new or existing data disk to a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • data_disk_properties (DataDiskProperties)

    Request body for adding a

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

    A hash of custom headers that



1001
1002
1003
1004
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1001

def begin_add_data_disk(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
  response = begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers).value!
  nil
end

#begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil) ⇒ Concurrent::Promise

Attach a new or existing data disk to virtual machine. This operation can take a while to complete.

new or existing data disk to a virtual machine. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • data_disk_properties (DataDiskProperties)

    Request body for adding a

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1038

def begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'data_disk_properties is nil' if data_disk_properties.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

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

  # Serialize Request
  request_mapper = Azure::ARM::DevTestLabs::Models::DataDiskProperties.mapper()
  request_content = @client.serialize(request_mapper,  data_disk_properties)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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
  end

  promise.execute
end

#begin_add_data_disk_with_http_info(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Attach a new or existing data disk to virtual machine. This operation can take a while to complete.

new or existing data disk to a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • data_disk_properties (DataDiskProperties)

    Request body for adding a

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1020
1021
1022
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1020

def begin_add_data_disk_with_http_info(resource_group_name, lab_name, name, data_disk_properties, custom_headers = nil)
  begin_add_data_disk_async(resource_group_name, lab_name, name, data_disk_properties, custom_headers).value!
end

#begin_apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil) ⇒ Object

Apply artifacts to virtual machine. This operation can take a while to complete.

applying artifacts to a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • apply_artifacts_request (ApplyArtifactsRequest)

    Request body for

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

    A hash of custom headers that



1104
1105
1106
1107
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1104

def begin_apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
  response = begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
  nil
end

#begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil) ⇒ Concurrent::Promise

Apply artifacts to virtual machine. This operation can take a while to complete.

applying artifacts to a virtual machine. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • apply_artifacts_request (ApplyArtifactsRequest)

    Request body for

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1141

def begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'apply_artifacts_request is nil' if apply_artifacts_request.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

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

  # Serialize Request
  request_mapper = Azure::ARM::DevTestLabs::Models::ApplyArtifactsRequest.mapper()
  request_content = @client.serialize(request_mapper,  apply_artifacts_request)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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
  end

  promise.execute
end

#begin_apply_artifacts_with_http_info(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Apply artifacts to virtual machine. This operation can take a while to complete.

applying artifacts to a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • apply_artifacts_request (ApplyArtifactsRequest)

    Request body for

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1123
1124
1125
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1123

def begin_apply_artifacts_with_http_info(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
  begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
end

#begin_claim(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Take ownership of an existing virtual machine This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



1205
1206
1207
1208
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1205

def begin_claim(resource_group_name, lab_name, name, custom_headers = nil)
  response = begin_claim_async(resource_group_name, lab_name, name, custom_headers).value!
  nil
end

#begin_claim_async(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Take ownership of an existing virtual machine This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1238

def begin_claim_async(resource_group_name, lab_name, name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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
  end

  promise.execute
end

#begin_claim_with_http_info(resource_group_name, lab_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Take ownership of an existing virtual machine This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



1222
1223
1224
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1222

def begin_claim_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
  begin_claim_async(resource_group_name, lab_name, name, custom_headers).value!
end

#begin_create_or_update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ LabVirtualMachine

Create or replace an existing Virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachine)

    A virtual machine.

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

    A hash of custom headers that

Returns:

  • (LabVirtualMachine)

    operation results.



796
797
798
799
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 796

def begin_create_or_update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  response = begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ Concurrent::Promise

Create or replace an existing Virtual machine. This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachine)

    A virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 831

def begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'lab_virtual_machine is nil' if lab_virtual_machine.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

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

  # Serialize Request
  request_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.mapper()
  request_content = @client.serialize(request_mapper,  lab_virtual_machine)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.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::ARM::DevTestLabs::Models::LabVirtualMachine.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, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create or replace an existing Virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachine)

    A virtual machine.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



814
815
816
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 814

def begin_create_or_update_with_http_info(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
end

#begin_delete(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Delete virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



914
915
916
917
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 914

def begin_delete(resource_group_name, lab_name, name, custom_headers = nil)
  response = begin_delete_async(resource_group_name, lab_name, name, custom_headers).value!
  nil
end

#begin_delete_async(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Delete virtual machine. This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 945

def begin_delete_async(resource_group_name, lab_name, name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      query_params: {'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 == 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
  end

  promise.execute
end

#begin_delete_with_http_info(resource_group_name, lab_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Delete virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



930
931
932
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 930

def begin_delete_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
  begin_delete_async(resource_group_name, lab_name, name, custom_headers).value!
end

#begin_detach_data_disk(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil) ⇒ Object

Detach the specified disk from the virtual machine. This operation can take a while to complete.

for detaching data disk from a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • detach_data_disk_properties (DetachDataDiskProperties)

    Request body

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

    A hash of custom headers that



1294
1295
1296
1297
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1294

def begin_detach_data_disk(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
  response = begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers).value!
  nil
end

#begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil) ⇒ Concurrent::Promise

Detach the specified disk from the virtual machine. This operation can take a while to complete.

for detaching data disk from a virtual machine. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • detach_data_disk_properties (DetachDataDiskProperties)

    Request body

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1331

def begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'detach_data_disk_properties is nil' if detach_data_disk_properties.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

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

  # Serialize Request
  request_mapper = Azure::ARM::DevTestLabs::Models::DetachDataDiskProperties.mapper()
  request_content = @client.serialize(request_mapper,  detach_data_disk_properties)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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
  end

  promise.execute
end

#begin_detach_data_disk_with_http_info(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Detach the specified disk from the virtual machine. This operation can take a while to complete.

for detaching data disk from a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • detach_data_disk_properties (DetachDataDiskProperties)

    Request body

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1313
1314
1315
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1313

def begin_detach_data_disk_with_http_info(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
  begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers).value!
end

#begin_start(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Start a virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



1394
1395
1396
1397
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1394

def begin_start(resource_group_name, lab_name, name, custom_headers = nil)
  response = begin_start_async(resource_group_name, lab_name, name, custom_headers).value!
  nil
end

#begin_start_async(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Start a virtual machine. This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



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

def begin_start_async(resource_group_name, lab_name, name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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
  end

  promise.execute
end

#begin_start_with_http_info(resource_group_name, lab_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Start a virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



1410
1411
1412
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1410

def begin_start_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
  begin_start_async(resource_group_name, lab_name, name, custom_headers).value!
end

#begin_stop(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Stop a virtual machine This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



1478
1479
1480
1481
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1478

def begin_stop(resource_group_name, lab_name, name, custom_headers = nil)
  response = begin_stop_async(resource_group_name, lab_name, name, custom_headers).value!
  nil
end

#begin_stop_async(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Stop a virtual machine This operation can take a while to complete.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1509

def begin_stop_async(resource_group_name, lab_name, name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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
  end

  promise.execute
end

#begin_stop_with_http_info(resource_group_name, lab_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Stop a virtual machine This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



1494
1495
1496
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1494

def begin_stop_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
  begin_stop_async(resource_group_name, lab_name, name, custom_headers).value!
end

#claim(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Take ownership of an existing virtual machine This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



532
533
534
535
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 532

def claim(resource_group_name, lab_name, name, custom_headers = nil)
  response = claim_async(resource_group_name, lab_name, name, custom_headers).value!
  nil
end

#claim_async(resource_group_name, lab_name, 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.

  • lab_name (String)

    The name of the lab.

  • 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



547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 547

def claim_async(resource_group_name, lab_name, name, custom_headers = nil)
  # Send request
  promise = begin_claim_async(resource_group_name, lab_name, name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

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

  promise
end

#create_or_update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ LabVirtualMachine

Create or replace an existing Virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachine)

    A virtual machine.

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

    A hash of custom headers that

Returns:

  • (LabVirtualMachine)

    operation results.



250
251
252
253
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 250

def create_or_update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  response = create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachine)

    A 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



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 266

def create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.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

#delete(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Delete virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



293
294
295
296
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 293

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

#delete_async(resource_group_name, lab_name, 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.

  • lab_name (String)

    The name of the lab.

  • 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



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 308

def delete_async(resource_group_name, lab_name, name, custom_headers = nil)
  # Send request
  promise = begin_delete_async(resource_group_name, lab_name, name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

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

  promise
end

#detach_data_disk(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil) ⇒ Object

Detach the specified disk from the virtual machine. This operation can take a while to complete.

for detaching data disk from a virtual machine. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • detach_data_disk_properties (DetachDataDiskProperties)

    Request body

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

    A hash of custom headers that



575
576
577
578
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 575

def detach_data_disk(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
  response = detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers).value!
  nil
end

#detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil) ⇒ Concurrent::Promise

for detaching data disk from a virtual machine. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • detach_data_disk_properties (DetachDataDiskProperties)

    Request body

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 592

def detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, custom_headers = nil)
  # Send request
  promise = begin_detach_data_disk_async(resource_group_name, lab_name, name, detach_data_disk_properties, 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

#get(resource_group_name, lab_name, name, expand = nil, custom_headers = nil) ⇒ LabVirtualMachine

Get virtual machine.

‘properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • expand (String) (defaults to: nil)

    Specify the $expand query. Example:

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

    A hash of custom headers that

Returns:

  • (LabVirtualMachine)

    operation results.



149
150
151
152
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 149

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

#get_async(resource_group_name, lab_name, name, expand = nil, custom_headers = nil) ⇒ Concurrent::Promise

Get virtual machine.

‘properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • expand (String) (defaults to: nil)

    Specify the $expand query. Example:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 184

def get_async(resource_group_name, lab_name, name, expand = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.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, lab_name, name, expand = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get virtual machine.

‘properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • expand (String) (defaults to: nil)

    Specify the $expand query. Example:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



167
168
169
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 167

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

#list(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil) ⇒ Array<LabVirtualMachine>

List virtual machines in a given lab.

‘properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)’ operation. notation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • expand (String) (defaults to: nil)

    Specify the $expand query. Example:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • orderby (String) (defaults to: nil)

    The ordering expression for the results, using OData

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

    A hash of custom headers that

Returns:

  • (Array<LabVirtualMachine>)

    operation results.



41
42
43
44
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 41

def list(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
  first_page = list_as_lazy(resource_group_name, lab_name, expand, filter, top, orderby, custom_headers)
  first_page.get_all_items
end

#list_applicable_schedules(resource_group_name, lab_name, name, custom_headers = nil) ⇒ ApplicableSchedule

Lists all applicable schedules

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (ApplicableSchedule)

    operation results.



619
620
621
622
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 619

def list_applicable_schedules(resource_group_name, lab_name, name, custom_headers = nil)
  response = list_applicable_schedules_async(resource_group_name, lab_name, name, custom_headers).value!
  response.body unless response.nil?
end

#list_applicable_schedules_async(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Lists all applicable schedules

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



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
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 650

def list_applicable_schedules_async(resource_group_name, lab_name, name, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::DevTestLabs::Models::ApplicableSchedule.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_applicable_schedules_with_http_info(resource_group_name, lab_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all applicable schedules

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

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



635
636
637
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 635

def list_applicable_schedules_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
  list_applicable_schedules_async(resource_group_name, lab_name, name, custom_headers).value!
end

#list_as_lazy(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil) ⇒ ResponseWithContinuationLabVirtualMachine

List virtual machines in a given lab.

‘properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)’ operation. notation. will be added to the HTTP request.

to pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • expand (String) (defaults to: nil)

    Specify the $expand query. Example:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • orderby (String) (defaults to: nil)

    The ordering expression for the results, using OData

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

    A hash of custom headers that

Returns:

  • (ResponseWithContinuationLabVirtualMachine)

    which provide lazy access



1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1657

def list_as_lazy(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
  response = list_async(resource_group_name, lab_name, expand, filter, top, orderby, 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)
    end
    page
  end
end

#list_async(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil) ⇒ Concurrent::Promise

List virtual machines in a given lab.

‘properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)’ operation. notation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • expand (String) (defaults to: nil)

    Specify the $expand query. Example:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • orderby (String) (defaults to: nil)

    The ordering expression for the results, using OData

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 84

def list_async(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/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,'resourceGroupName' => resource_group_name,'labName' => lab_name},
      query_params: {'$expand' => expand,'$filter' => filter,'$top' => top,'$orderby' => orderby,'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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::DevTestLabs::Models::ResponseWithContinuationLabVirtualMachine.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(next_page_link, custom_headers = nil) ⇒ ResponseWithContinuationLabVirtualMachine

List virtual machines in a given lab.

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:

  • (ResponseWithContinuationLabVirtualMachine)

    operation results.



1562
1563
1564
1565
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1562

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

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

List virtual machines in a given lab.

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.



1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1591

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


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::DevTestLabs::Models::ResponseWithContinuationLabVirtualMachine.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

List virtual machines in a given lab.

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.



1577
1578
1579
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 1577

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

#list_with_http_info(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

List virtual machines in a given lab.

‘properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)’ operation. notation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • expand (String) (defaults to: nil)

    Specify the $expand query. Example:

  • filter (String) (defaults to: nil)

    The filter to apply to the operation.

  • top (Integer) (defaults to: nil)

    The maximum number of resources to return from the

  • orderby (String) (defaults to: nil)

    The ordering expression for the results, using OData

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



63
64
65
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 63

def list_with_http_info(resource_group_name, lab_name, expand = nil, filter = nil, top = nil, orderby = nil, custom_headers = nil)
  list_async(resource_group_name, lab_name, expand, filter, top, orderby, custom_headers).value!
end

#start(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Start a virtual machine. This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



712
713
714
715
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 712

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

#start_async(resource_group_name, lab_name, 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.

  • lab_name (String)

    The name of the lab.

  • 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



727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 727

def start_async(resource_group_name, lab_name, name, custom_headers = nil)
  # Send request
  promise = begin_start_async(resource_group_name, lab_name, name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

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

  promise
end

#stop(resource_group_name, lab_name, name, custom_headers = nil) ⇒ Object

Stop a virtual machine This operation can take a while to complete.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

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

    A hash of custom headers that



752
753
754
755
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 752

def stop(resource_group_name, lab_name, name, custom_headers = nil)
  response = stop_async(resource_group_name, lab_name, name, custom_headers).value!
  nil
end

#stop_async(resource_group_name, lab_name, 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.

  • lab_name (String)

    The name of the lab.

  • 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



767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 767

def stop_async(resource_group_name, lab_name, name, custom_headers = nil)
  # Send request
  promise = begin_stop_async(resource_group_name, lab_name, name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

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

  promise
end

#update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ LabVirtualMachine

Modify properties of virtual machines.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachineFragment)

    A virtual machine.

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

    A hash of custom headers that

Returns:

  • (LabVirtualMachine)

    operation results.



336
337
338
339
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 336

def update(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  response = update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ Concurrent::Promise

Modify properties of virtual machines.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachineFragment)

    A virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 369

def update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'lab_name is nil' if lab_name.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'lab_virtual_machine is nil' if lab_virtual_machine.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

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

  # Serialize Request
  request_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachineFragment.mapper()
  request_content = @client.serialize(request_mapper,  lab_virtual_machine)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ARM::DevTestLabs::Models::LabVirtualMachine.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

#update_with_http_info(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Modify properties of virtual machines.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • lab_name (String)

    The name of the lab.

  • name (String)

    The name of the virtual machine.

  • lab_virtual_machine (LabVirtualMachineFragment)

    A virtual machine.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



353
354
355
# File 'lib/generated/azure_mgmt_devtestlabs/virtual_machines.rb', line 353

def update_with_http_info(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
  update_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
end