class Azure::Compute::Mgmt::V2020_10_01_preview::CloudServiceRoleInstances

Compute Client

Attributes

client[R]

@return [ComputeManagementClient] reference to the ComputeManagementClient

Private Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the CloudServiceRoleInstances class. @param client service class for accessing basic functionality.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 17
def initialize(client)
  @client = client
end

Private Instance Methods

begin_delete(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Deletes a role instance from a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 615
def begin_delete(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = begin_delete_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
begin_delete_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Deletes a role instance from a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 646
def begin_delete_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'role_instance_name is nil' if role_instance_name.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}/roleInstances/{roleInstanceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleInstanceName' => role_instance_name,'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_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Deletes a role instance from a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 631
def begin_delete_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  begin_delete_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end
begin_rebuild(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Rebuild Role Instance asynchronous operation 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 Instance.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 885
def begin_rebuild(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = begin_rebuild_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
begin_rebuild_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Rebuild Role Instance asynchronous operation 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 Instance.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 922
def begin_rebuild_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'role_instance_name is nil' if role_instance_name.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}/roleInstances/{roleInstanceName}/rebuild'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleInstanceName' => role_instance_name,'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_rebuild_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Rebuild Role Instance asynchronous operation 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 Instance.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 904
def begin_rebuild_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  begin_rebuild_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end
begin_reimage(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

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

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 793
def begin_reimage(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = begin_reimage_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
begin_reimage_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

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

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 826
def begin_reimage_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'role_instance_name is nil' if role_instance_name.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}/roleInstances/{roleInstanceName}/reimage'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleInstanceName' => role_instance_name,'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_reimage_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

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

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 810
def begin_reimage_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  begin_reimage_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end
begin_restart(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 703
def begin_restart(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = begin_restart_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
begin_restart_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 736
def begin_restart_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'role_instance_name is nil' if role_instance_name.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}/roleInstances/{roleInstanceName}/restart'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleInstanceName' => role_instance_name,'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_restart_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 720
def begin_restart_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  begin_restart_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end
delete(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Deletes a role instance from a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 33
def delete(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = delete_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
delete_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 48
def delete_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(role_instance_name, 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
get(role_instance_name, resource_group_name, cloud_service_name, expand:nil, custom_headers:nil) click to toggle source

Gets a role instance from a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param expand [InstanceViewTypes] The expand expression to apply to the operation. Possible values include: 'instanceView' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [RoleInstance] operation results.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 77
def get(role_instance_name, resource_group_name, cloud_service_name, expand:nil, custom_headers:nil)
  response = get_async(role_instance_name, resource_group_name, cloud_service_name, expand:expand, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(role_instance_name, resource_group_name, cloud_service_name, expand:nil, custom_headers:nil) click to toggle source

Gets a role instance from a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param expand [InstanceViewTypes] The expand expression to apply to the operation. Possible values include: 'instanceView' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 112
def get_async(role_instance_name, resource_group_name, cloud_service_name, expand:nil, custom_headers:nil)
  fail ArgumentError, 'role_instance_name is nil' if role_instance_name.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}/roleInstances/{roleInstanceName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleInstanceName' => role_instance_name,'resourceGroupName' => resource_group_name,'cloudServiceName' => cloud_service_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version,'$expand' => expand},
      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::RoleInstance.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(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Retrieves information about the run-time state of a role instance in a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [RoleInstanceInstanceView] operation results.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 180
def get_instance_view(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = get_instance_view_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_instance_view_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Retrieves information about the run-time state of a role instance in a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 213
def get_instance_view_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'role_instance_name is nil' if role_instance_name.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}/roleInstances/{roleInstanceName}/instanceView'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleInstanceName' => role_instance_name,'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::RoleInstanceInstanceView.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(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Retrieves information about the run-time state of a role instance in a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 197
def get_instance_view_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  get_instance_view_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end
get_remote_desktop_file(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Gets a remote desktop file for a role instance in a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [NOT_IMPLEMENTED] operation results.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 511
def get_remote_desktop_file(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = get_remote_desktop_file_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_remote_desktop_file_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Gets a remote desktop file for a role instance in a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 542
def get_remote_desktop_file_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  fail ArgumentError, 'role_instance_name is nil' if role_instance_name.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}/roleInstances/{roleInstanceName}/remoteDesktopFile'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'roleInstanceName' => role_instance_name,'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 = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Stream'
          }
        }
        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_remote_desktop_file_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

Gets a remote desktop file for a role instance in a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 527
def get_remote_desktop_file_with_http_info(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  get_remote_desktop_file_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
end
get_with_http_info(role_instance_name, resource_group_name, cloud_service_name, expand:nil, custom_headers:nil) click to toggle source

Gets a role instance from a cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param expand [InstanceViewTypes] The expand expression to apply to the operation. Possible values include: 'instanceView' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 95
def get_with_http_info(role_instance_name, resource_group_name, cloud_service_name, expand:nil, custom_headers:nil)
  get_async(role_instance_name, resource_group_name, cloud_service_name, expand:expand, custom_headers:custom_headers).value!
end
list(resource_group_name, cloud_service_name, expand:nil, custom_headers:nil) click to toggle source

Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

@param resource_group_name [String] @param cloud_service_name [String] @param expand [InstanceViewTypes] The expand expression to apply to the operation. Possible values include: 'instanceView' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<RoleInstance>] operation results.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 283
def list(resource_group_name, cloud_service_name, expand:nil, custom_headers:nil)
  first_page = list_as_lazy(resource_group_name, cloud_service_name, expand:expand, custom_headers:custom_headers)
  first_page.get_all_items
end
list_as_lazy(resource_group_name, cloud_service_name, expand:nil, custom_headers:nil) click to toggle source

Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

@param resource_group_name [String] @param cloud_service_name [String] @param expand [InstanceViewTypes] The expand expression to apply to the operation. Possible values include: 'instanceView' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [RoleInstanceListResult] which provide lazy access to pages of the response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 1079
def list_as_lazy(resource_group_name, cloud_service_name, expand:nil, custom_headers:nil)
  response = list_async(resource_group_name, cloud_service_name, expand:expand, 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, cloud_service_name, expand:nil, custom_headers:nil) click to toggle source

Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

@param resource_group_name [String] @param cloud_service_name [String] @param expand [InstanceViewTypes] The expand expression to apply to the operation. Possible values include: 'instanceView' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 320
def list_async(resource_group_name, cloud_service_name, expand: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?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances'

  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,'$expand' => expand},
      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::RoleInstanceListResult.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) click to toggle source

Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [RoleInstanceListResult] operation results.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 980
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) click to toggle source

Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 1013
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::RoleInstanceListResult.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) click to toggle source

Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 997
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, cloud_service_name, expand:nil, custom_headers:nil) click to toggle source

Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this till nextLink is null to fetch all the role instances.

@param resource_group_name [String] @param cloud_service_name [String] @param expand [InstanceViewTypes] The expand expression to apply to the operation. Possible values include: 'instanceView' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 302
def list_with_http_info(resource_group_name, cloud_service_name, expand:nil, custom_headers:nil)
  list_async(resource_group_name, cloud_service_name, expand:expand, custom_headers:custom_headers).value!
end
rebuild(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Rebuild Role Instance asynchronous operation 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 Instance.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 469
def rebuild(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = rebuild_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
rebuild_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 484
def rebuild_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  # Send request
  promise = begin_rebuild_async(role_instance_name, 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
reimage(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

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

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 426
def reimage(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = reimage_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
reimage_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 441
def reimage_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  # Send request
  promise = begin_reimage_async(role_instance_name, 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
restart(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service.

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 385
def restart(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  response = restart_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:custom_headers).value!
  nil
end
restart_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil) click to toggle source

@param role_instance_name [String] Name of the role instance. @param resource_group_name [String] @param cloud_service_name [String] @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2020-10-01-preview/generated/azure_mgmt_compute/cloud_service_role_instances.rb, line 400
def restart_async(role_instance_name, resource_group_name, cloud_service_name, custom_headers:nil)
  # Send request
  promise = begin_restart_async(role_instance_name, 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