Class: Azure::Compute::Mgmt::V2020_10_01_preview::CloudServices

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb

Overview

Compute Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CloudServices

Creates and initializes a new instance of the CloudServices class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientComputeManagementClient (readonly)

Returns reference to the ComputeManagementClient.

Returns:



22
23
24
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ CloudService

Create or update a cloud service. Please note some properties can be set only during cloud service creation.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudService) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (CloudService)

    operation results.



783
784
785
786
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 783

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

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

Create or update a cloud service. Please note some properties can be set only during cloud service creation.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudService) (defaults to: nil)

    The cloud service object.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 816

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


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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::CloudService.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/cloudServices/{cloudServiceName}'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::CloudService.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::CloudService.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, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update a cloud service. Please note some properties can be set only during cloud service creation.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudService) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



800
801
802
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 800

def begin_create_or_update_with_http_info(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ Object

Deletes a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that



1001
1002
1003
1004
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1001

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

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

Deletes a cloud service.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1030

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


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'cloudServiceName' => cloud_service_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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_delete_instances(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Object

Deletes role instances in a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



1545
1546
1547
1548
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1545

def begin_delete_instances(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  response = begin_delete_instances_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

#begin_delete_instances_async(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Concurrent::Promise

Deletes role instances in a cloud service.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1576

def begin_delete_instances_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cloud_service_name is nil' if cloud_service_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::RoleInstances.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/cloudServices/{cloudServiceName}/delete'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_delete_instances_with_http_info(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes role instances in a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1561
1562
1563
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1561

def begin_delete_instances_with_http_info(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  begin_delete_instances_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
end

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

Deletes a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1016
1017
1018
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1016

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

#begin_power_off(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ Object

Power off the cloud service. Note that resources are still attached and you are getting charged for the resources.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that



1168
1169
1170
1171
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1168

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

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

Power off the cloud service. Note that resources are still attached and you are getting charged for the resources.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
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
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1199

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/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,'cloudServiceName' => cloud_service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

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

    result
  end

  promise.execute
end

#begin_power_off_with_http_info(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Power off the cloud service. Note that resources are still attached and you are getting charged for the resources.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1184
1185
1186
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1184

def begin_power_off_with_http_info(resource_group_name, cloud_service_name, custom_headers:nil)
  begin_power_off_async(resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end

#begin_rebuild(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Object

Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instances.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



1446
1447
1448
1449
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1446

def begin_rebuild(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  response = begin_rebuild_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

#begin_rebuild_async(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Concurrent::Promise

Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instances.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1483

def begin_rebuild_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cloud_service_name is nil' if cloud_service_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::RoleInstances.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/cloudServices/{cloudServiceName}/rebuild'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

#begin_rebuild_with_http_info(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instances.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1465
1466
1467
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1465

def begin_rebuild_with_http_info(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  begin_rebuild_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
end

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

Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



1348
1349
1350
1351
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1348

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

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

Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1381

def begin_reimage_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cloud_service_name is nil' if cloud_service_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::RoleInstances.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/cloudServices/{cloudServiceName}/reimage'

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end

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

Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1365
1366
1367
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1365

def begin_reimage_with_http_info(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  begin_reimage_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
end

#begin_restart(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Object

Restarts one or more role instances in a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



1254
1255
1256
1257
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1254

def begin_restart(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  response = begin_restart_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

#begin_restart_async(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Concurrent::Promise

Restarts one or more role instances in a cloud service.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1285

def begin_restart_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cloud_service_name is nil' if cloud_service_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::RoleInstances.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/cloudServices/{cloudServiceName}/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,'cloudServiceName' => cloud_service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

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

    result
  end

  promise.execute
end

#begin_restart_with_http_info(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Restarts one or more role instances in a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1270
1271
1272
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1270

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

#begin_start(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ Object

Starts the cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that



1084
1085
1086
1087
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1084

def begin_start(resource_group_name, cloud_service_name, custom_headers:nil)
  response = begin_start_async(resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end

#begin_start_async(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ Concurrent::Promise

Starts the cloud service.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1113

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


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/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,'cloudServiceName' => cloud_service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

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

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

    result
  end

  promise.execute
end

#begin_start_with_http_info(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Starts the cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1099
1100
1101
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1099

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

#begin_update(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ CloudService

Update a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudServiceUpdate) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (CloudService)

    operation results.



899
900
901
902
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 899

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

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

Update a cloud service.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudServiceUpdate) (defaults to: nil)

    The cloud service object.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 930

def begin_update_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cloud_service_name is nil' if cloud_service_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  # Serialize Request
  request_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::CloudServiceUpdate.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/cloudServices/{cloudServiceName}'

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::CloudService.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_update_with_http_info(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Update a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudServiceUpdate) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



915
916
917
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 915

def begin_update_with_http_info(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  begin_update_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
end

#create_or_update(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ CloudService

Create or update a cloud service. Please note some properties can be set only during cloud service creation.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudService) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (CloudService)

    operation results.



36
37
38
39
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 36

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudService) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 51

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

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

Deletes a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that



121
122
123
124
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 121

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 135

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

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

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

  promise
end

#delete_instances(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Object

Deletes role instances in a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



740
741
742
743
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 740

def delete_instances(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  response = delete_instances_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

#delete_instances_async(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 755

def delete_instances_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  # Send request
  promise = begin_delete_instances_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers)

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

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

  promise
end

#get(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ CloudService

Display information about a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (CloudService)

    operation results.



161
162
163
164
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 161

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

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

Display information about a cloud service.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 190

def get_async(resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cloud_service_name is nil' if cloud_service_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::CloudService.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_instance_view(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ CloudServiceInstanceView

Gets the status of a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (CloudServiceInstanceView)

    operation results.



255
256
257
258
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 255

def get_instance_view(resource_group_name, cloud_service_name, custom_headers:nil)
  response = get_instance_view_async(resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_instance_view_async(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the status of a cloud service.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 284

def get_instance_view_async(resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cloud_service_name is nil' if cloud_service_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/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,'cloudServiceName' => cloud_service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

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

Gets the status of a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



270
271
272
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 270

def get_instance_view_with_http_info(resource_group_name, cloud_service_name, custom_headers:nil)
  get_instance_view_async(resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end

#get_with_http_info(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Display information about a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



176
177
178
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 176

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

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

Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

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

    A hash of custom headers that

Returns:

  • (Array<CloudService>)

    operation results.



445
446
447
448
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 445

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

#list_all(custom_headers: nil) ⇒ Array<CloudService>

Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<CloudService>)

    operation results.



350
351
352
353
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 350

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

#list_all_as_lazy(custom_headers: nil) ⇒ CloudServiceListResult

Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

will be added to the HTTP request.

response.

Parameters:

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

    A hash of custom headers that

Returns:

  • (CloudServiceListResult)

    which provide lazy access to pages of the



1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1835

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

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

Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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.



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 381

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


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

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

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

Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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:

  • (CloudServiceListResult)

    operation results.



1641
1642
1643
1644
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1641

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

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

Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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.



1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
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
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1676

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


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

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

Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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.



1659
1660
1661
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1659

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

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

Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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.



366
367
368
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 366

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

#list_as_lazy(resource_group_name, custom_headers: nil) ⇒ CloudServiceListResult

Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

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

    A hash of custom headers that

Returns:

  • (CloudServiceListResult)

    which provide lazy access to pages of the



1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1858

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

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

Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    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.



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

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


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

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

  request_url = @base_url || @client.base_url

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

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

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Compute::Mgmt::V2020_10_01_preview::Models::CloudServiceListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_next(next_page_link, custom_headers: nil) ⇒ CloudServiceListResult

Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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:

  • (CloudServiceListResult)

    operation results.



1739
1740
1741
1742
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1739

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

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

Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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.



1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1772

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


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

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

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

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

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

Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

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.



1756
1757
1758
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 1756

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

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

Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this till nextLink is null to fetch all the Cloud Services.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    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.



461
462
463
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 461

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

#power_off(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ Object

Power off the cloud service. Note that resources are still attached and you are getting charged for the resources.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that



577
578
579
580
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 577

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 591

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

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

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

  promise
end

#rebuild(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Object

Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources that are used by them. If you do not want to initialize storage resources, you can use Reimage Role Instances.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



700
701
702
703
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 700

def rebuild(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  response = rebuild_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

#rebuild_async(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 715

def rebuild_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  # Send request
  promise = begin_rebuild_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers)

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

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

  promise
end

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

Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



657
658
659
660
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 657

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 672

def reimage_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  # Send request
  promise = begin_reimage_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers)

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

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

  promise
end

#restart(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Object

Restarts one or more role instances in a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that



616
617
618
619
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 616

def restart(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  response = restart_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers).value!
  nil
end

#restart_async(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (RoleInstances) (defaults to: nil)

    List of cloud service role instance names.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 631

def restart_async(resource_group_name, cloud_service_name, parameters:nil, custom_headers:nil)
  # Send request
  promise = begin_restart_async(resource_group_name, cloud_service_name, parameters:parameters, custom_headers:custom_headers)

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

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

  promise
end

#start(resource_group_name, cloud_service_name, custom_headers: nil) ⇒ Object

Starts the cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that



538
539
540
541
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 538

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 552

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

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

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

  promise
end

#update(resource_group_name, cloud_service_name, parameters: nil, custom_headers: nil) ⇒ CloudService

Update a cloud service.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudServiceUpdate) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (CloudService)

    operation results.



80
81
82
83
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 80

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

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

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    Name of the resource group.

  • cloud_service_name (String)

    Name of the cloud service.

  • parameters (CloudServiceUpdate) (defaults to: nil)

    The cloud service object.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_services.rb', line 95

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

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