# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::Compute # # The Compute Management Client. # class VirtualMachineScaleSets include Azure::ARM::Compute::Models include MsRestAzure # # Creates and initializes a new instance of the VirtualMachineScaleSets class. # @param client service class for accessing basic functionality. # def initialize(client) @client = client end # @return [ComputeManagementClient] reference to the ComputeManagementClient attr_reader :client # # Allows you to create or update a virtual machine scale set by providing # parameters or a path to pre-configured parameter file. # # @param resource_group_name [String] The name of the resource group. # @param name [String] Parameters supplied to the Create Virtual Machine Scale # Set operation. # @param parameters [VirtualMachineScaleSet] Parameters supplied to the Create # Virtual Machine Scale Set operation. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [VirtualMachineScaleSet] operation results. # def create_or_update(resource_group_name, name, parameters, custom_headers = nil) response = create_or_update_async(resource_group_name, name, parameters, custom_headers).value! response.body unless response.nil? end # # @param resource_group_name [String] The name of the resource group. # @param name [String] Parameters supplied to the Create Virtual Machine Scale # Set operation. # @param parameters [VirtualMachineScaleSet] Parameters supplied to the Create # Virtual Machine Scale Set operation. # @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. # def create_or_update_async(resource_group_name, name, parameters, custom_headers = nil) # Send request promise = begin_create_or_update_async(resource_group_name, name, parameters, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| result_mapper = VirtualMachineScaleSet.mapper() parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response') end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Allows you to create or update a virtual machine scale set by providing # parameters or a path to pre-configured parameter file. # # @param resource_group_name [String] The name of the resource group. # @param name [String] Parameters supplied to the Create Virtual Machine Scale # Set operation. # @param parameters [VirtualMachineScaleSet] Parameters supplied to the Create # Virtual Machine Scale Set operation. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [VirtualMachineScaleSet] operation results. # def begin_create_or_update(resource_group_name, name, parameters, custom_headers = nil) response = begin_create_or_update_async(resource_group_name, name, parameters, custom_headers).value! response.body unless response.nil? end # # Allows you to create or update a virtual machine scale set by providing # parameters or a path to pre-configured parameter file. # # @param resource_group_name [String] The name of the resource group. # @param name [String] Parameters supplied to the Create Virtual Machine Scale # Set operation. # @param parameters [VirtualMachineScaleSet] Parameters supplied to the Create # Virtual Machine Scale Set 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. # def begin_create_or_update_with_http_info(resource_group_name, name, parameters, custom_headers = nil) begin_create_or_update_async(resource_group_name, name, parameters, custom_headers).value! end # # Allows you to create or update a virtual machine scale set by providing # parameters or a path to pre-configured parameter file. # # @param resource_group_name [String] The name of the resource group. # @param name [String] Parameters supplied to the Create Virtual Machine Scale # Set operation. # @param parameters [VirtualMachineScaleSet] Parameters supplied to the Create # Virtual Machine Scale Set 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. # def begin_create_or_update_async(resource_group_name, name, parameters, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'name is nil' if name.nil? fail ArgumentError, 'parameters is nil' if parameters.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = VirtualMachineScaleSet.mapper() request_content = @client.serialize(request_mapper, parameters, 'parameters') request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSet.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 = VirtualMachineScaleSet.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Allows you to deallocate virtual machines in a virtual machine scale set. # Shuts down the virtual machines and releases the compute resources. You are # not billed for the compute resources that this virtual machine scale set # uses. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def deallocate(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) # Send request promise = begin_deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids, 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 # # Allows you to deallocate virtual machines in a virtual machine scale set. # Shuts down the virtual machines and releases the compute resources. You are # not billed for the compute resources that this virtual machine scale set # uses. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_deallocate(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = begin_deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # Allows you to deallocate virtual machines in a virtual machine scale set. # Shuts down the virtual machines and releases the compute resources. You are # not billed for the compute resources that this virtual machine scale set # uses. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_deallocate_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) begin_deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! end # # Allows you to deallocate virtual machines in a virtual machine scale set. # Shuts down the virtual machines and releases the compute resources. You are # not billed for the compute resources that this virtual machine scale set # uses. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_deallocate_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = VirtualMachineScaleSetVMInstanceIDs.mapper() request_content = @client.serialize(request_mapper, vm_instance_ids, 'vm_instance_ids') request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Allows you to delete a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def delete(resource_group_name, vm_scale_set_name, custom_headers = nil) response = delete_async(resource_group_name, vm_scale_set_name, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def delete_async(resource_group_name, vm_scale_set_name, custom_headers = nil) # Send request promise = begin_delete_async(resource_group_name, vm_scale_set_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Allows you to delete a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_delete(resource_group_name, vm_scale_set_name, custom_headers = nil) response = begin_delete_async(resource_group_name, vm_scale_set_name, custom_headers).value! nil end # # Allows you to delete a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def begin_delete_with_http_info(resource_group_name, vm_scale_set_name, custom_headers = nil) begin_delete_async(resource_group_name, vm_scale_set_name, custom_headers).value! end # # Allows you to delete a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def begin_delete_async(resource_group_name, vm_scale_set_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Display information about a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [VirtualMachineScaleSet] operation results. # def get(resource_group_name, vm_scale_set_name, custom_headers = nil) response = get_async(resource_group_name, vm_scale_set_name, custom_headers).value! response.body unless response.nil? end # # Display information about a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def get_with_http_info(resource_group_name, vm_scale_set_name, custom_headers = nil) get_async(resource_group_name, vm_scale_set_name, custom_headers).value! end # # Display information about a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def get_async(resource_group_name, vm_scale_set_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSet.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Allows you to delete virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def delete_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) response = delete_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @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. # def delete_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) # Send request promise = begin_delete_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, 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 # # Allows you to delete virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_delete_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) response = begin_delete_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # Allows you to delete virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @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. # def begin_delete_instances_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) begin_delete_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! end # # Allows you to delete virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @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. # def begin_delete_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, 'vm_instance_ids is nil' if vm_instance_ids.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = VirtualMachineScaleSetVMInstanceRequiredIDs.mapper() request_content = @client.serialize(request_mapper, vm_instance_ids, 'vm_instance_ids') request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Displays status of a virtual machine scale set instance. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [VirtualMachineScaleSetInstanceView] operation results. # def get_instance_view(resource_group_name, vm_scale_set_name, custom_headers = nil) response = get_instance_view_async(resource_group_name, vm_scale_set_name, custom_headers).value! response.body unless response.nil? end # # Displays status of a virtual machine scale set instance. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def get_instance_view_with_http_info(resource_group_name, vm_scale_set_name, custom_headers = nil) get_instance_view_async(resource_group_name, vm_scale_set_name, custom_headers).value! end # # Displays status of a virtual machine scale set instance. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def get_instance_view_async(resource_group_name, vm_scale_set_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSetInstanceView.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Lists all virtual machine scale sets under a resource group. # # @param resource_group_name [String] The name of the resource group. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [VirtualMachineScaleSetListResult] which provide lazy access to # pages of the response. # def list_as_lazy(resource_group_name, custom_headers = nil) response = list_async(resource_group_name, custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_link| list_next_async(next_link, custom_headers) end page end end # # Lists all virtual machine scale sets under a resource group. # # @param resource_group_name [String] The name of the resource group. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Array] operation results. # def list(resource_group_name, custom_headers = nil) first_page = list_as_lazy(resource_group_name, custom_headers) first_page.get_all_items end # # Lists all virtual machine scale sets under a resource group. # # @param resource_group_name [String] The name of the resource group. # @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. # def list_with_http_info(resource_group_name, custom_headers = nil) list_async(resource_group_name, custom_headers).value! end # # Lists all virtual machine scale sets under a resource group. # # @param resource_group_name [String] The name of the resource group. # @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. # def list_async(resource_group_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets' 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 || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSetListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Lists all Virtual Machine Scale Sets in the subscription. Use nextLink # property in the response to get the next page of Virtual Machine Scale # Sets. Do this till nextLink is not null to fetch all the Virtual Machine # Scale Sets. # # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [VirtualMachineScaleSetListWithLinkResult] which provide lazy access # to pages of the response. # def list_all_as_lazy(custom_headers = nil) response = list_all_async(custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_link| list_all_next_async(next_link, custom_headers) end page end end # # Lists all Virtual Machine Scale Sets in the subscription. Use nextLink # property in the response to get the next page of Virtual Machine Scale # Sets. Do this till nextLink is not null to fetch all the Virtual Machine # Scale Sets. # # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Array] operation results. # def list_all(custom_headers = nil) first_page = list_all_as_lazy(custom_headers) first_page.get_all_items end # # Lists all Virtual Machine Scale Sets in the subscription. Use nextLink # property in the response to get the next page of Virtual Machine Scale # Sets. Do this till nextLink is not null to fetch all the Virtual Machine # Scale Sets. # # @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. # def list_all_with_http_info(custom_headers = nil) list_all_async(custom_headers).value! end # # Lists all Virtual Machine Scale Sets in the subscription. Use nextLink # property in the response to get the next page of Virtual Machine Scale # Sets. Do this till nextLink is not null to fetch all the Virtual Machine # Scale Sets. # # @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. # def list_all_async(custom_headers = nil) fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets' 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 || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSetListWithLinkResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Displays available skus for your virtual machine scale set including the # minimum and maximum vm instances allowed for a particular sku. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [VirtualMachineScaleSetListSkusResult] which provide lazy access to # pages of the response. # def list_skus_as_lazy(resource_group_name, vm_scale_set_name, custom_headers = nil) response = list_skus_async(resource_group_name, vm_scale_set_name, custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_link| list_skus_next_async(next_link, custom_headers) end page end end # # Displays available skus for your virtual machine scale set including the # minimum and maximum vm instances allowed for a particular sku. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [Array] operation results. # def list_skus(resource_group_name, vm_scale_set_name, custom_headers = nil) first_page = list_skus_as_lazy(resource_group_name, vm_scale_set_name, custom_headers) first_page.get_all_items end # # Displays available skus for your virtual machine scale set including the # minimum and maximum vm instances allowed for a particular sku. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def list_skus_with_http_info(resource_group_name, vm_scale_set_name, custom_headers = nil) list_skus_async(resource_group_name, vm_scale_set_name, custom_headers).value! end # # Displays available skus for your virtual machine scale set including the # minimum and maximum vm instances allowed for a particular sku. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def list_skus_async(resource_group_name, vm_scale_set_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSetListSkusResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Allows you to power off (stop) virtual machines in a virtual machine scale # set. Note that resources are still attached and you are getting charged for # the resources. Use deallocate to release resources. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def power_off(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) # Send request promise = begin_power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids, 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 # # Allows you to power off (stop) virtual machines in a virtual machine scale # set. Note that resources are still attached and you are getting charged for # the resources. Use deallocate to release resources. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_power_off(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = begin_power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # Allows you to power off (stop) virtual machines in a virtual machine scale # set. Note that resources are still attached and you are getting charged for # the resources. Use deallocate to release resources. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_power_off_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) begin_power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! end # # Allows you to power off (stop) virtual machines in a virtual machine scale # set. Note that resources are still attached and you are getting charged for # the resources. Use deallocate to release resources. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_power_off_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = VirtualMachineScaleSetVMInstanceIDs.mapper() request_content = @client.serialize(request_mapper, vm_instance_ids, 'vm_instance_ids') request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Allows you to restart virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def restart(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) # Send request promise = begin_restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids, 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 # # Allows you to restart virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_restart(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = begin_restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # Allows you to restart virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_restart_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) begin_restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! end # # Allows you to restart virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_restart_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = VirtualMachineScaleSetVMInstanceIDs.mapper() request_content = @client.serialize(request_mapper, vm_instance_ids, 'vm_instance_ids') request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Allows you to start virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def start(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = start_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def start_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) # Send request promise = begin_start_async(resource_group_name, vm_scale_set_name, vm_instance_ids, 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 # # Allows you to start virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_start(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) response = begin_start_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # Allows you to start virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_start_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) begin_start_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! end # # Allows you to start virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of # virtual machine scale set instance IDs. # @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. # def begin_start_async(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = VirtualMachineScaleSetVMInstanceIDs.mapper() request_content = @client.serialize(request_mapper, vm_instance_ids, 'vm_instance_ids') request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Allows you to manually upgrade virtual machines in a virtual machine scale # set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def update_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) response = update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @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. # def update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) # Send request promise = begin_update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, 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 # # Allows you to manually upgrade virtual machines in a virtual machine scale # set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_update_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) response = begin_update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! nil end # # Allows you to manually upgrade virtual machines in a virtual machine scale # set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @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. # def begin_update_instances_with_http_info(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) begin_update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers).value! end # # Allows you to manually upgrade virtual machines in a virtual machine scale # set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The # list of virtual machine scale set instance IDs. # @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. # def begin_update_instances_async(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, 'vm_instance_ids is nil' if vm_instance_ids.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? request_headers['Content-Type'] = 'application/json; charset=utf-8' # Serialize Request request_mapper = VirtualMachineScaleSetVMInstanceRequiredIDs.mapper() request_content = @client.serialize(request_mapper, vm_instance_ids, 'vm_instance_ids') request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Allows you to re-image(update the version of the installed operating system) # virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # def reimage(resource_group_name, vm_scale_set_name, custom_headers = nil) response = reimage_async(resource_group_name, vm_scale_set_name, custom_headers).value! nil end # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def reimage_async(resource_group_name, vm_scale_set_name, custom_headers = nil) # Send request promise = begin_reimage_async(resource_group_name, vm_scale_set_name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_long_running_operation_result(response, deserialize_method) end promise end # # Allows you to re-image(update the version of the installed operating system) # virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # def begin_reimage(resource_group_name, vm_scale_set_name, custom_headers = nil) response = begin_reimage_async(resource_group_name, vm_scale_set_name, custom_headers).value! nil end # # Allows you to re-image(update the version of the installed operating system) # virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def begin_reimage_with_http_info(resource_group_name, vm_scale_set_name, custom_headers = nil) begin_reimage_async(resource_group_name, vm_scale_set_name, custom_headers).value! end # # Allows you to re-image(update the version of the installed operating system) # virtual machines in a virtual machine scale set. # # @param resource_group_name [String] The name of the resource group. # @param vm_scale_set_name [String] The name of the virtual machine scale set. # @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. # def begin_reimage_async(resource_group_name, vm_scale_set_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_response| status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result end promise.execute end # # Lists all virtual machine scale sets under a resource group. # # @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 [VirtualMachineScaleSetListResult] operation results. # def list_next(next_page_link, custom_headers = nil) response = list_next_async(next_page_link, custom_headers).value! response.body unless response.nil? end # # Lists all virtual machine scale sets under a resource group. # # @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. # def list_next_with_http_info(next_page_link, custom_headers = nil) list_next_async(next_page_link, custom_headers).value! end # # Lists all virtual machine scale sets under a resource group. # # @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. # def list_next_async(next_page_link, custom_headers = nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' 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 || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSetListResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Lists all Virtual Machine Scale Sets in the subscription. Use nextLink # property in the response to get the next page of Virtual Machine Scale # Sets. Do this till nextLink is not null to fetch all the Virtual Machine # Scale Sets. # # @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 [VirtualMachineScaleSetListWithLinkResult] operation results. # def list_all_next(next_page_link, custom_headers = nil) response = list_all_next_async(next_page_link, custom_headers).value! response.body unless response.nil? end # # Lists all Virtual Machine Scale Sets in the subscription. Use nextLink # property in the response to get the next page of Virtual Machine Scale # Sets. Do this till nextLink is not null to fetch all the Virtual Machine # Scale Sets. # # @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. # def list_all_next_with_http_info(next_page_link, custom_headers = nil) list_all_next_async(next_page_link, custom_headers).value! end # # Lists all Virtual Machine Scale Sets in the subscription. Use nextLink # property in the response to get the next page of Virtual Machine Scale # Sets. Do this till nextLink is not null to fetch all the Virtual Machine # Scale Sets. # # @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. # def list_all_next_async(next_page_link, custom_headers = nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' 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 || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSetListWithLinkResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 # # Displays available skus for your virtual machine scale set including the # minimum and maximum vm instances allowed for a particular sku. # # @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 [VirtualMachineScaleSetListSkusResult] operation results. # def list_skus_next(next_page_link, custom_headers = nil) response = list_skus_next_async(next_page_link, custom_headers).value! response.body unless response.nil? end # # Displays available skus for your virtual machine scale set including the # minimum and maximum vm instances allowed for a particular sku. # # @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. # def list_skus_next_with_http_info(next_page_link, custom_headers = nil) list_skus_next_async(next_page_link, custom_headers).value! end # # Displays available skus for your virtual machine scale set including the # minimum and maximum vm instances allowed for a particular sku. # # @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. # def list_skus_next_async(next_page_link, custom_headers = nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' 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 || {}) } request_url = @base_url || @client.base_url request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options) promise = request.run_promise do |req| @client.credentials.sign_request(req) unless @client.credentials.nil? end promise = promise.then do |http_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(request, http_response, error_model) end # Create Result result = MsRestAzure::AzureOperationResponse.new(request, http_response) result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = VirtualMachineScaleSetListSkusResult.mapper() result.body = @client.deserialize(result_mapper, parsed_response, 'result.body') 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 end end