Class: Azure::Compute::Mgmt::V2017_03_30::VirtualMachines

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb

Overview

VirtualMachines

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/2017-03-30/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/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 22

def client
  @client
end

Instance Method Details

#begin_capture(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ VirtualMachineCaptureResult

Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (VirtualMachineCaptureResult)

    operation results.



1068
1069
1070
1071
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1068

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

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

Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.

the Capture Virtual Machine operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1103

def begin_capture_async(resource_group_name, vm_name, parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'vm_name is nil' if vm_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2017_03_30::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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::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.



1086
1087
1088
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1086

def begin_capture_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil)
  begin_capture_async(resource_group_name, vm_name, parameters, custom_headers).value!
end

#begin_convert_to_managed_disks(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



1384
1385
1386
1387
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1384

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).value!
  response.body unless response.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.



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

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 = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_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.



1400
1401
1402
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1400

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

#begin_create_or_update(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ VirtualMachine

The operation to create or update a virtual machine.

Machine operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

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

    A hash of custom headers that

Returns:

  • (VirtualMachine)

    operation results.



1177
1178
1179
1180
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1177

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

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

The operation to create or update a virtual machine.

Machine operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
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
1280
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1210

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


  request_headers = {}

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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2017_03_30::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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::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::V2017_03_30::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.

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.



1194
1195
1196
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1194

def begin_create_or_update_with_http_info(resource_group_name, vm_name, parameters, custom_headers = nil)
  begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers).value!
end

#begin_deallocate(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



1478
1479
1480
1481
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1478

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



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
1551
1552
1553
1554
1555
1556
1557
1558
1559
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1509

def begin_deallocate_async(resource_group_name, vm_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'vm_name is nil' if vm_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_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.



1494
1495
1496
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1494

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

#begin_delete(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

The operation to delete a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (OperationStatusResponse)

    operation results.



1292
1293
1294
1295
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1292

def begin_delete(resource_group_name, vm_name, custom_headers = nil)
  response = begin_delete_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.nil?
end

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

The operation to delete a virtual machine.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
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
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1321

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


  request_headers = {}

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

  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(: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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_delete_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to delete a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1307
1308
1309
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1307

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

#begin_perform_maintenance(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



1941
1942
1943
1944
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1941

def begin_perform_maintenance(resource_group_name, vm_name, custom_headers = nil)
  response = begin_perform_maintenance_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.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.



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
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1970

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 = {}

  # 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_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.



1956
1957
1958
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1956

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

#begin_power_off(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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.

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:

  • (OperationStatusResponse)

    operation results.



1573
1574
1575
1576
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1573

def begin_power_off(resource_group_name, vm_name, custom_headers = nil)
  response = begin_power_off_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.nil?
end

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

The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still charged for this 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.



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
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1606

def begin_power_off_async(resource_group_name, vm_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'vm_name is nil' if vm_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_power_off_with_http_info(resource_group_name, vm_name, 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.

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.



1590
1591
1592
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1590

def begin_power_off_with_http_info(resource_group_name, vm_name, custom_headers = nil)
  begin_power_off_async(resource_group_name, vm_name, custom_headers).value!
end

#begin_redeploy(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

The operation to redeploy a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (OperationStatusResponse)

    operation results.



1850
1851
1852
1853
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1850

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

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

The operation to redeploy a virtual machine.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1879

def begin_redeploy_async(resource_group_name, vm_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'vm_name is nil' if vm_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_redeploy_with_http_info(resource_group_name, vm_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to redeploy a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1865
1866
1867
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1865

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

#begin_restart(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



1668
1669
1670
1671
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1668

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



1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1697

def begin_restart_async(resource_group_name, vm_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'vm_name is nil' if vm_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_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.



1683
1684
1685
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1683

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

#begin_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.



2034
2035
2036
2037
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2034

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



2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2067

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 = {}

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



2051
2052
2053
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2051

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

#begin_start(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



1759
1760
1761
1762
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1759

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



1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1788

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


  request_headers = {}

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

  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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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_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.



1774
1775
1776
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1774

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

#capture(resource_group_name, vm_name, parameters, custom_headers = nil) ⇒ VirtualMachineCaptureResult

Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs.

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

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (VirtualMachineCaptureResult)

    operation results.



37
38
39
40
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 37

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

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

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

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachineCaptureParameters)

    Parameters supplied to

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



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

def capture_async(resource_group_name, vm_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_capture_async(resource_group_name, vm_name, parameters, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::VirtualMachineCaptureResult.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

#convert_to_managed_disks(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



361
362
363
364
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 361

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).value!
  response.body unless response.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



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 375

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)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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

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

The operation to create or update a virtual machine.

Machine operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

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

    A hash of custom headers that

Returns:

  • (VirtualMachine)

    operation results.



83
84
85
86
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 83

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

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

Machine operation. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • parameters (VirtualMachine)

    Parameters supplied to the Create Virtual

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 99

def create_or_update_async(resource_group_name, vm_name, parameters, custom_headers = nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, vm_name, parameters, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::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) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



404
405
406
407
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 404

def deallocate(resource_group_name, vm_name, custom_headers = nil)
  response = deallocate_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.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



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 418

def deallocate_async(resource_group_name, vm_name, custom_headers = nil)
  # Send request
  promise = begin_deallocate_async(resource_group_name, vm_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

The operation to delete a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (OperationStatusResponse)

    operation results.



127
128
129
130
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 127

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 141

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

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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

#generalize(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

Sets the state of the virtual machine to generalized.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (OperationStatusResponse)

    operation results.



446
447
448
449
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 446

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

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

Sets the state of the virtual machine to generalized.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 475

def generalize_async(resource_group_name, vm_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'vm_name is nil' if vm_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'

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

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

Sets the state of the virtual machine to generalized.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



461
462
463
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 461

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

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

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.



172
173
174
175
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 172

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

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

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.



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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 207

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


  request_headers = {}

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

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



190
191
192
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 190

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

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



269
270
271
272
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 269

def instance_view(resource_group_name, vm_name, custom_headers = nil)
  response = instance_view_async(resource_group_name, vm_name, 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.



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 298

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 = {}

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



284
285
286
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 284

def instance_view_with_http_info(resource_group_name, vm_name, custom_headers = nil)
  instance_view_async(resource_group_name, vm_name, 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.



537
538
539
540
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 537

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

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

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.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<VirtualMachine>)

    operation results.



626
627
628
629
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 626

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

#list_all_as_lazy(custom_headers = nil) ⇒ VirtualMachineListResult

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.

will be added to the HTTP request.

response.

Parameters:

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

    A hash of custom headers that

Returns:

  • (VirtualMachineListResult)

    which provide lazy access to pages of the



2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2341

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

#list_all_async(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 the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 653

def list_all_async(custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'

  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},
      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::Compute::Mgmt::V2017_03_30::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.



2230
2231
2232
2233
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2230

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

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

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.



2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2261

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


  request_headers = {}

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

  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::Compute::Mgmt::V2017_03_30::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.



2246
2247
2248
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2246

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

#list_all_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

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.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



640
641
642
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 640

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

#list_as_lazy(resource_group_name, custom_headers = nil) ⇒ VirtualMachineListResult

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



2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2320

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



566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 566

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


  request_headers = {}

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

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



714
715
716
717
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 714

def list_available_sizes(resource_group_name, vm_name, custom_headers = nil)
  response = list_available_sizes_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.nil?
end

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

Lists all available virtual machine sizes 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.



745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 745

def list_available_sizes_async(resource_group_name, vm_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'vm_name is nil' if vm_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes'

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



730
731
732
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 730

def list_available_sizes_with_http_info(resource_group_name, vm_name, custom_headers = nil)
  list_available_sizes_async(resource_group_name, vm_name, custom_headers).value!
end

#list_next(next_page_link, custom_headers = nil) ⇒ VirtualMachineListResult

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.



2140
2141
2142
2143
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2140

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

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.



2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2171

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::Compute::Mgmt::V2017_03_30::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.



2156
2157
2158
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 2156

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

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

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.



552
553
554
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 552

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

#perform_maintenance(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



977
978
979
980
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 977

def perform_maintenance(resource_group_name, vm_name, custom_headers = nil)
  response = perform_maintenance_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.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



991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 991

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)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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

#power_off(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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.

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:

  • (OperationStatusResponse)

    operation results.



809
810
811
812
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 809

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 823

def power_off_async(resource_group_name, vm_name, custom_headers = nil)
  # Send request
  promise = begin_power_off_async(resource_group_name, vm_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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

#redeploy(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

The operation to redeploy a virtual machine.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • vm_name (String)

    The name of the virtual machine.

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

    A hash of custom headers that

Returns:

  • (OperationStatusResponse)

    operation results.



935
936
937
938
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 935

def redeploy(resource_group_name, vm_name, custom_headers = nil)
  response = redeploy_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.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



949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 949

def redeploy_async(resource_group_name, vm_name, custom_headers = nil)
  # Send request
  promise = begin_redeploy_async(resource_group_name, vm_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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

#restart(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



851
852
853
854
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 851

def restart(resource_group_name, vm_name, custom_headers = nil)
  response = restart_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.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



865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 865

def restart_async(resource_group_name, vm_name, custom_headers = nil)
  # Send request
  promise = begin_restart_async(resource_group_name, vm_name, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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

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



1021
1022
1023
1024
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1021

def run_command(resource_group_name, vm_name, parameters, custom_headers = nil)
  response = run_command_async(resource_group_name, vm_name, parameters, 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



1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 1037

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)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::RunCommandResult.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

#start(resource_group_name, vm_name, custom_headers = nil) ⇒ OperationStatusResponse

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:

  • (OperationStatusResponse)

    operation results.



893
894
895
896
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 893

def start(resource_group_name, vm_name, custom_headers = nil)
  response = start_async(resource_group_name, vm_name, custom_headers).value!
  response.body unless response.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



907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
# File 'lib/2017-03-30/generated/azure_mgmt_compute/virtual_machines.rb', line 907

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

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::Compute::Mgmt::V2017_03_30::Models::OperationStatusResponse.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