# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::Web # # Use these APIs to manage Azure Websites resources through the Azure # Resource Manager. All task operations conform to the HTTP/1.1 protocol # specification and each operation returns an x-ms-request-id header that # can be used to obtain information about the request. You must make sure # that requests made to these resources are secure. For more information, # see Authenticating # Azure Resource Manager requests. # class HostingEnvironments include Azure::ARM::Web::Models include MsRestAzure # # Creates and initializes a new instance of the HostingEnvironments class. # @param client service class for accessing basic functionality. # def initialize(client) @client = client end # @return reference to the WebSiteManagementClient attr_reader :client # # Get properties of hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = HostingEnvironment.deserialize_object(parsed_response) end result.body = 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 # # Create or update a hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param hosting_environment_envelope [HostingEnvironment] Properties of # hostingEnvironment (App Service Environment) # @param @client.subscription_id [String] Subscription Id # @param @client.api_version [String] API Version # @param @client.accept_language [String] Gets or sets the preferred language # for the response. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def create_or_update_hosting_environment(resource_group_name, name, hosting_environment_envelope, custom_headers = nil) # Send request promise = begin_create_or_update_hosting_environment(resource_group_name, name, hosting_environment_envelope, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| unless parsed_response.nil? parsed_response = HostingEnvironment.deserialize_object(parsed_response) end end # Waiting for response. @client.get_put_operation_result(response, deserialize_method) end promise end # # Create or update a hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param hosting_environment_envelope [HostingEnvironment] Properties of # hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def begin_create_or_update_hosting_environment(resource_group_name, name, hosting_environment_envelope, 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, 'hosting_environment_envelope is nil' if hosting_environment_envelope.nil? hosting_environment_envelope.validate unless hosting_environment_envelope.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 = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_headers['Content-Type'] = 'application/json; charset=utf-8' unless hosting_environment_envelope.nil? hosting_environment_envelope = HostingEnvironment.serialize_object(hosting_environment_envelope) end request_content = JSON.generate(hosting_environment_envelope, quirks_mode: true) path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{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 = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 == 202 || status_code == 400 || status_code == 404 || status_code == 409 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) unless parsed_response.nil? parsed_response = HostingEnvironment.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end # Deserialize Response if status_code == 202 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = HostingEnvironment.deserialize_object(parsed_response) end result.body = 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 # # Delete a hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param force_delete [Boolean] Delete even if the hostingEnvironment (App # Service Environment) contains resources # @return [Concurrent::Promise] promise which provides async access to http # response. # def delete_hosting_environment(resource_group_name, name, force_delete = nil, custom_headers = nil) # Send request promise = begin_delete_hosting_environment(resource_group_name, name, force_delete, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| end # Waiting for response. @client.get_post_or_delete_operation_result(response, deserialize_method) end promise end # # Delete a hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param force_delete [Boolean] Delete even if the hostingEnvironment (App # Service Environment) contains resources # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def begin_delete_hosting_environment(resource_group_name, name, force_delete = nil, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{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: {'forceDelete' => force_delete,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 == 400 || status_code == 404 || status_code == 409 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 # # Get diagnostic information for hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_diagnostics(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/diagnostics' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? deserialized_array = [] parsed_response.each do |element| unless element.nil? element = HostingEnvironmentDiagnostics.deserialize_object(element) end deserialized_array.push(element) end parsed_response = deserialized_array end result.body = 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 diagnostic information for hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param diagnostics_name [String] Name of the diagnostics # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_diagnostics_item(resource_group_name, name, diagnostics_name, 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, 'diagnostics_name is nil' if diagnostics_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 = {} # 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.Web/hostingEnvironments/{name}/diagnostics/{diagnosticsName}' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'diagnosticsName' => diagnostics_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = HostingEnvironmentDiagnostics.deserialize_object(parsed_response) end result.body = 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 used, available, and total worker capacity for hostingEnvironment (App # Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_capacities(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/compute' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = StampCapacityCollection.deserialize_object(parsed_response) end result.body = 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 IP addresses assigned to the hostingEnvironment (App Service # Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_vips(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/capacities/virtualip' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = AddressResponse.deserialize_object(parsed_response) end result.body = 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 all hostingEnvironments (App Service Environments) in a resource group. # # @param resource_group_name [String] Name of resource group # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environments(resource_group_name, custom_headers = nil) fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil? fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # 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.Web/hostingEnvironments' 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 = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = HostingEnvironmentCollection.deserialize_object(parsed_response) end result.body = 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 # # Reboots all machines in a hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def reboot_hosting_environment(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/reboot' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 || status_code == 400 || status_code == 404 || status_code == 409 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 # # List all currently running operations on the hostingEnvironment (App Service # Environment) # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_operations(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/operations' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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? result end promise.execute end # # Get status of an operation on a hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param operation_id [String] operation identifier GUID # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_operation(resource_group_name, name, operation_id, 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, 'operation_id is nil' if operation_id.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 = {} # 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.Web/hostingEnvironments/{name}/operations/{operationId}' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'operationId' => operation_id,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 || status_code == 202 || status_code == 404 || status_code == 500 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 # # Get global metrics of hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param details [Boolean] Include instance details # @param filter [String] Return only usages/metrics specified in the filter. # Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' # or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and # endTime eq '2014-12-31T23:59:59Z' and timeGrain eq # duration'[Hour|Minute|Day]'. # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_metrics(resource_group_name, name, details = nil, filter = nil, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metrics' 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: {'details' => details,'$filter' => filter,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = ResourceMetricCollection.deserialize_object(parsed_response) end result.body = 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 global metric definitions of hostingEnvironment (App Service # Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_metric_definitions(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = MetricDefinition.deserialize_object(parsed_response) end result.body = 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 global usages of hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param filter [String] Return only usages/metrics specified in the filter. # Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' # or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and # endTime eq '2014-12-31T23:59:59Z' and timeGrain eq # duration'[Hour|Minute|Day]'. # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_usages(resource_group_name, name, filter = nil, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/usages' 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: {'$filter' => filter,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = CsmUsageQuotaCollection.deserialize_object(parsed_response) end result.body = 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 metrics for a multiRole pool of a hostingEnvironment (App Service # Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param start_time [String] Beginning time of metrics query # @param end_time [String] End time of metrics query # @param time_grain [String] Time granularity of metrics query # @param details [Boolean] Include instance details # @param filter [String] Return only usages/metrics specified in the filter. # Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' # or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and # endTime eq '2014-12-31T23:59:59Z' and timeGrain eq # duration'[Hour|Minute|Day]'. # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_multi_role_metrics(resource_group_name, name, start_time = nil, end_time = nil, time_grain = nil, details = nil, filter = nil, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metrics' 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: {'startTime' => start_time,'endTime' => end_time,'timeGrain' => time_grain,'details' => details,'$filter' => filter,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = ResourceMetricCollection.deserialize_object(parsed_response) end result.body = 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 metrics for a worker pool of a hostingEnvironment (App Service # Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param details [Boolean] Include instance details # @param filter [String] Return only usages/metrics specified in the filter. # Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' # or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and # endTime eq '2014-12-31T23:59:59Z' and timeGrain eq # duration'[Hour|Minute|Day]'. # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_web_worker_metrics(resource_group_name, name, worker_pool_name, details = nil, filter = nil, 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, 'worker_pool_name is nil' if worker_pool_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 = {} # 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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metrics' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'subscriptionId' => @client.subscription_id}, query_params: {'details' => details,'$filter' => filter,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = ResourceMetricCollection.deserialize_object(parsed_response) end result.body = 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 metric definitions for a multiRole pool of a hostingEnvironment (App # Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_multi_role_metric_definitions(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/metricdefinitions' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = MetricDefinitionCollection.deserialize_object(parsed_response) end result.body = 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 metric definitions for a worker pool of a hostingEnvironment (App # Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_web_worker_metric_definitions(resource_group_name, name, worker_pool_name, 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, 'worker_pool_name is nil' if worker_pool_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 = {} # 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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/metricdefinitions' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = MetricDefinitionCollection.deserialize_object(parsed_response) end result.body = 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 usages for a multiRole pool of a hostingEnvironment (App Service # Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_multi_role_usages(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/usages' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = UsageCollection.deserialize_object(parsed_response) end result.body = 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 usages for a worker pool of a hostingEnvironment (App Service # Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_web_worker_usages(resource_group_name, name, worker_pool_name, 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, 'worker_pool_name is nil' if worker_pool_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 = {} # 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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/usages' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = UsageCollection.deserialize_object(parsed_response) end result.body = 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 all sites on the hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param properties_to_include [String] Comma separated list of site # properties to include # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_sites(resource_group_name, name, properties_to_include = nil, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/sites' 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: {'propertiesToInclude' => properties_to_include,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = SiteCollection.deserialize_object(parsed_response) end result.body = 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 all serverfarms (App Service Plans) on the hostingEnvironment (App # Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_server_farms(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/serverfarms' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = ServerFarmCollection.deserialize_object(parsed_response) end result.body = 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 all serverfarms (App Service Plans) on the hostingEnvironment (App # Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_hosting_environment_web_hosting_plans(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/webhostingplans' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = ServerFarmCollection.deserialize_object(parsed_response) end result.body = 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 all multi role pools # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_multi_role_pools(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = WorkerPoolCollection.deserialize_object(parsed_response) end result.body = 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 properties of a multiRool pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_multi_role_pool(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end result.body = 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 # # Create or update a multiRole pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param multi_role_pool_envelope [WorkerPool] Properties of multiRole pool # @param @client.subscription_id [String] Subscription Id # @param @client.api_version [String] API Version # @param @client.accept_language [String] Gets or sets the preferred language # for the response. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def create_or_update_multi_role_pool(resource_group_name, name, multi_role_pool_envelope, custom_headers = nil) # Send request promise = begin_create_or_update_multi_role_pool(resource_group_name, name, multi_role_pool_envelope, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end end # Waiting for response. @client.get_put_operation_result(response, deserialize_method) end promise end # # Create or update a multiRole pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param multi_role_pool_envelope [WorkerPool] Properties of multiRole pool # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def begin_create_or_update_multi_role_pool(resource_group_name, name, multi_role_pool_envelope, 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, 'multi_role_pool_envelope is nil' if multi_role_pool_envelope.nil? multi_role_pool_envelope.validate unless multi_role_pool_envelope.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 = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_headers['Content-Type'] = 'application/json; charset=utf-8' unless multi_role_pool_envelope.nil? multi_role_pool_envelope = WorkerPool.serialize_object(multi_role_pool_envelope) end request_content = JSON.generate(multi_role_pool_envelope, quirks_mode: true) path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default' 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 = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 == 202 || status_code == 400 || status_code == 404 || status_code == 409 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) unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end # Deserialize Response if status_code == 202 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end result.body = 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 available skus for scaling a multiRole pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_multi_role_pool_skus(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = SkuInfoCollection.deserialize_object(parsed_response) end result.body = 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 all worker pools # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_worker_pools(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = WorkerPoolCollection.deserialize_object(parsed_response) end result.body = 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 properties of a worker pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_worker_pool(resource_group_name, name, worker_pool_name, 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, 'worker_pool_name is nil' if worker_pool_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 = {} # 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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end result.body = 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 # # Create or update a worker pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param worker_pool_envelope [WorkerPool] Properties of worker pool # @param @client.subscription_id [String] Subscription Id # @param @client.api_version [String] API Version # @param @client.accept_language [String] Gets or sets the preferred language # for the response. # # @return [Concurrent::Promise] promise which provides async access to http # response. # def create_or_update_worker_pool(resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers = nil) # Send request promise = begin_create_or_update_worker_pool(resource_group_name, name, worker_pool_name, worker_pool_envelope, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end end # Waiting for response. @client.get_put_operation_result(response, deserialize_method) end promise end # # Create or update a worker pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param worker_pool_envelope [WorkerPool] Properties of worker pool # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def begin_create_or_update_worker_pool(resource_group_name, name, worker_pool_name, worker_pool_envelope, 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, 'worker_pool_name is nil' if worker_pool_name.nil? fail ArgumentError, 'worker_pool_envelope is nil' if worker_pool_envelope.nil? worker_pool_envelope.validate unless worker_pool_envelope.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 = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_headers['Content-Type'] = 'application/json; charset=utf-8' unless worker_pool_envelope.nil? worker_pool_envelope = WorkerPool.serialize_object(worker_pool_envelope) end request_content = JSON.generate(worker_pool_envelope, quirks_mode: true) path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, body: request_content, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 == 202 || status_code == 400 || status_code == 404 || status_code == 409 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) unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end # Deserialize Response if status_code == 202 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = WorkerPool.deserialize_object(parsed_response) end result.body = 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 available skus for scaling a worker pool. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_worker_pool_skus(resource_group_name, name, worker_pool_name, 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, 'worker_pool_name is nil' if worker_pool_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 = {} # 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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/skus' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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) unless parsed_response.nil? parsed_response = SkuInfoCollection.deserialize_object(parsed_response) end result.body = 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 metrics for a specific instance of a worker pool of a hostingEnvironment # (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param instance [String] Name of instance in the worker pool # @param details [Boolean] Include instance details # @param filter [String] Return only usages/metrics specified in the filter. # Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' # or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and # endTime eq '2014-12-31T23:59:59Z' and timeGrain eq # duration'[Hour|Minute|Day]'. # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_worker_pool_instance_metrics(resource_group_name, name, worker_pool_name, instance, details = nil, filter = nil, 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, 'worker_pool_name is nil' if worker_pool_name.nil? fail ArgumentError, 'instance is nil' if instance.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 = {} # 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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metrics' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'instance' => instance,'subscriptionId' => @client.subscription_id}, query_params: {'details' => details,'$filter' => filter,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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? result end promise.execute end # # Get metric definitions for a specific instance of a worker pool of a # hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param worker_pool_name [String] Name of worker pool # @param instance [String] Name of instance in the worker pool # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_worker_pool_instance_metric_definitions(resource_group_name, name, worker_pool_name, instance, 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, 'worker_pool_name is nil' if worker_pool_name.nil? fail ArgumentError, 'instance is nil' if instance.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 = {} # 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.Web/hostingEnvironments/{name}/workerPools/{workerPoolName}/instances/{instance}/metricdefinitions' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'workerPoolName' => worker_pool_name,'instance' => instance,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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? result end promise.execute end # # Get metrics for a specific instance of a multiRole pool of a # hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param instance [String] Name of instance in the multiRole pool # @param details [Boolean] Include instance details # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_multi_role_pool_instance_metrics(resource_group_name, name, instance, details = nil, 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, 'instance is nil' if instance.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 = {} # 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.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metrics' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'instance' => instance,'subscriptionId' => @client.subscription_id}, query_params: {'details' => details,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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? result end promise.execute end # # Get metric definitions for a specific instance of a multiRole pool of a # hostingEnvironment (App Service Environment). # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param instance [String] Name of instance in the multiRole pool> # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def get_multi_role_pool_instance_metric_definitions(resource_group_name, name, instance, 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, 'instance is nil' if instance.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 = {} # 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.Web/hostingEnvironments/{name}/multiRolePools/default/instances/{instance}/metricdefinitions' options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'resourceGroupName' => resource_group_name,'name' => name,'instance' => instance,'subscriptionId' => @client.subscription_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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? result end promise.execute end # # Suspends the hostingEnvironment. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @return [Concurrent::Promise] promise which provides async access to http # response. # def suspend_hosting_environment(resource_group_name, name, custom_headers = nil) # Send request promise = begin_suspend_hosting_environment(resource_group_name, name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| unless parsed_response.nil? parsed_response = SiteCollection.deserialize_object(parsed_response) end end # Waiting for response. @client.get_post_or_delete_operation_result(response, deserialize_method) end promise end # # Suspends the hostingEnvironment. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def begin_suspend_hosting_environment(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/suspend' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 == 200 || 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? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = SiteCollection.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end # Deserialize Response if status_code == 202 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = SiteCollection.deserialize_object(parsed_response) end result.body = 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 # # Resumes the hostingEnvironment. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @return [Concurrent::Promise] promise which provides async access to http # response. # def resume_hosting_environment(resource_group_name, name, custom_headers = nil) # Send request promise = begin_resume_hosting_environment(resource_group_name, name, custom_headers) promise = promise.then do |response| # Defining deserialization method. deserialize_method = lambda do |parsed_response| unless parsed_response.nil? parsed_response = SiteCollection.deserialize_object(parsed_response) end end # Waiting for response. @client.get_post_or_delete_operation_result(response, deserialize_method) end promise end # # Resumes the hostingEnvironment. # # @param resource_group_name [String] Name of resource group # @param name [String] Name of hostingEnvironment (App Service Environment) # @param [Hash{String => String}] The hash of custom headers need to be # applied to HTTP request. # # @return [Concurrent::Promise] Promise object which allows to get HTTP # response. # def begin_resume_hosting_environment(resource_group_name, name, 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, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/resume' 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}, headers: request_headers.merge(custom_headers || {}) } request = MsRest::HttpOperationRequest.new(@base_url || @client.base_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 == 200 || 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? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = SiteCollection.deserialize_object(parsed_response) end result.body = parsed_response rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end # Deserialize Response if status_code == 202 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) unless parsed_response.nil? parsed_response = SiteCollection.deserialize_object(parsed_response) end result.body = 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 end end