class Azure::Web::Mgmt::V2016_03_01::Recommendations

WebSite Management Client

Attributes

client[R]

@return [WebSiteManagementClient] reference to the WebSiteManagementClient

Private Class Methods

new(client) click to toggle source

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 17
def initialize(client)
  @client = client
end

Private Instance Methods

disable_all_for_web_app(resource_group_name, site_name, custom_headers:nil) click to toggle source

Disable all recommendations for an app.

Disable all recommendations for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 566
def disable_all_for_web_app(resource_group_name, site_name, custom_headers:nil)
  response = disable_all_for_web_app_async(resource_group_name, site_name, custom_headers:custom_headers).value!
  nil
end
disable_all_for_web_app_async(resource_group_name, site_name, custom_headers:nil) click to toggle source

Disable all recommendations for an app.

Disable all recommendations for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 601
def disable_all_for_web_app_async(resource_group_name, site_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+[^\.]$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+[^\.]$$')).nil?
  fail ArgumentError, 'site_name is nil' if site_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
disable_all_for_web_app_with_http_info(resource_group_name, site_name, custom_headers:nil) click to toggle source

Disable all recommendations for an app.

Disable all recommendations for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 584
def disable_all_for_web_app_with_http_info(resource_group_name, site_name, custom_headers:nil)
  disable_all_for_web_app_async(resource_group_name, site_name, custom_headers:custom_headers).value!
end
disable_recommendation_for_site(resource_group_name, site_name, name, custom_headers:nil) click to toggle source

Disables the specific rule for a web site permanently.

Disables the specific rule for a web site permanently.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Site name @param name [String] Rule name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 879
def disable_recommendation_for_site(resource_group_name, site_name, name, custom_headers:nil)
  response = disable_recommendation_for_site_async(resource_group_name, site_name, name, custom_headers:custom_headers).value!
  nil
end
disable_recommendation_for_site_async(resource_group_name, site_name, name, custom_headers:nil) click to toggle source

Disables the specific rule for a web site permanently.

Disables the specific rule for a web site permanently.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Site name @param name [String] Rule name @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 916
def disable_recommendation_for_site_async(resource_group_name, site_name, name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+[^\.]$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+[^\.]$$')).nil?
  fail ArgumentError, 'site_name is nil' if site_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
disable_recommendation_for_site_with_http_info(resource_group_name, site_name, name, custom_headers:nil) click to toggle source

Disables the specific rule for a web site permanently.

Disables the specific rule for a web site permanently.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Site name @param name [String] Rule name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 898
def disable_recommendation_for_site_with_http_info(resource_group_name, site_name, name, custom_headers:nil)
  disable_recommendation_for_site_async(resource_group_name, site_name, name, custom_headers:custom_headers).value!
end
disable_recommendation_for_subscription(name, custom_headers:nil) click to toggle source

Disables the specified rule so it will not apply to a subscription in the future.

Disables the specified rule so it will not apply to a subscription in the future.

@param name [String] Rule name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 231
def disable_recommendation_for_subscription(name, custom_headers:nil)
  response = disable_recommendation_for_subscription_async(name, custom_headers:custom_headers).value!
  nil
end
disable_recommendation_for_subscription_async(name, custom_headers:nil) click to toggle source

Disables the specified rule so it will not apply to a subscription in the future.

Disables the specified rule so it will not apply to a subscription in the future.

@param name [String] Rule name @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 266
def disable_recommendation_for_subscription_async(name, custom_headers: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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
disable_recommendation_for_subscription_with_http_info(name, custom_headers:nil) click to toggle source

Disables the specified rule so it will not apply to a subscription in the future.

Disables the specified rule so it will not apply to a subscription in the future.

@param name [String] Rule name @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 249
def disable_recommendation_for_subscription_with_http_info(name, custom_headers:nil)
  disable_recommendation_for_subscription_async(name, custom_headers:custom_headers).value!
end
get_rule_details_by_web_app(resource_group_name, site_name, name, update_seen:nil, recommendation_id:nil, custom_headers:nil) click to toggle source

Get a recommendation rule for an app.

Get a recommendation rule for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param name [String] Name of the recommendation. @param update_seen [Boolean] Specify true to update the last-seen timestamp of the recommendation object. @param recommendation_id [String] The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [RecommendationRule] operation results.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 762
def get_rule_details_by_web_app(resource_group_name, site_name, name, update_seen:nil, recommendation_id:nil, custom_headers:nil)
  response = get_rule_details_by_web_app_async(resource_group_name, site_name, name, update_seen:update_seen, recommendation_id:recommendation_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_rule_details_by_web_app_async(resource_group_name, site_name, name, update_seen:nil, recommendation_id:nil, custom_headers:nil) click to toggle source

Get a recommendation rule for an app.

Get a recommendation rule for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param name [String] Name of the recommendation. @param update_seen [Boolean] Specify true to update the last-seen timestamp of the recommendation object. @param recommendation_id [String] The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 807
def get_rule_details_by_web_app_async(resource_group_name, site_name, name, update_seen:nil, recommendation_id:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+[^\.]$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+[^\.]$$')).nil?
  fail ArgumentError, 'site_name is nil' if site_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 = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
get_rule_details_by_web_app_with_http_info(resource_group_name, site_name, name, update_seen:nil, recommendation_id:nil, custom_headers:nil) click to toggle source

Get a recommendation rule for an app.

Get a recommendation rule for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param name [String] Name of the recommendation. @param update_seen [Boolean] Specify true to update the last-seen timestamp of the recommendation object. @param recommendation_id [String] The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 785
def get_rule_details_by_web_app_with_http_info(resource_group_name, site_name, name, update_seen:nil, recommendation_id:nil, custom_headers:nil)
  get_rule_details_by_web_app_async(resource_group_name, site_name, name, update_seen:update_seen, recommendation_id:recommendation_id, custom_headers:custom_headers).value!
end
list(featured:nil, filter:nil, custom_headers:nil) click to toggle source

List all recommendations for a subscription.

List all recommendations for a subscription.

@param featured [Boolean] Specify true to return only the most critical recommendations. The default is false, which returns all recommendations. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<Recommendation>] operation results.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 41
def list(featured:nil, filter:nil, custom_headers:nil)
  first_page = list_as_lazy(featured:featured, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end
list_as_lazy(featured:nil, filter:nil, custom_headers:nil) click to toggle source

List all recommendations for a subscription.

List all recommendations for a subscription.

@param featured [Boolean] Specify true to return only the most critical recommendations. The default is false, which returns all recommendations. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 1271
def list_as_lazy(featured:nil, filter:nil, custom_headers:nil)
  response = list_async(featured:featured, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_async(featured:nil, filter:nil, custom_headers:nil) click to toggle source

List all recommendations for a subscription.

List all recommendations for a subscription.

@param featured [Boolean] Specify true to return only the most critical recommendations. The default is false, which returns all recommendations. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 84
def list_async(featured:nil, filter:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
list_history_for_web_app(resource_group_name, site_name, filter:nil, custom_headers:nil) click to toggle source

Get past recommendations for an app, optionally specified by the time range.

Get past recommendations for an app, optionally specified by the time range.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<Recommendation>] operation results.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 327
def list_history_for_web_app(resource_group_name, site_name, filter:nil, custom_headers:nil)
  first_page = list_history_for_web_app_as_lazy(resource_group_name, site_name, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end
list_history_for_web_app_as_lazy(resource_group_name, site_name, filter:nil, custom_headers:nil) click to toggle source

Get past recommendations for an app, optionally specified by the time range.

Get past recommendations for an app, optionally specified by the time range.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 1300
def list_history_for_web_app_as_lazy(resource_group_name, site_name, filter:nil, custom_headers:nil)
  response = list_history_for_web_app_async(resource_group_name, site_name, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_history_for_web_app_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_history_for_web_app_async(resource_group_name, site_name, filter:nil, custom_headers:nil) click to toggle source

Get past recommendations for an app, optionally specified by the time range.

Get past recommendations for an app, optionally specified by the time range.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 370
def list_history_for_web_app_async(resource_group_name, site_name, filter:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+[^\.]$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+[^\.]$$')).nil?
  fail ArgumentError, 'site_name is nil' if site_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
list_history_for_web_app_next(next_page_link, custom_headers:nil) click to toggle source

Get past recommendations for an app, optionally specified by the time range.

Get past recommendations for an app, optionally specified by the time range.

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

@return [RecommendationCollection] operation results.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 1073
def list_history_for_web_app_next(next_page_link, custom_headers:nil)
  response = list_history_for_web_app_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_history_for_web_app_next_async(next_page_link, custom_headers:nil) click to toggle source

Get past recommendations for an app, optionally specified by the time range.

Get past recommendations for an app, optionally specified by the time range.

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

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 1106
def list_history_for_web_app_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
list_history_for_web_app_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Get past recommendations for an app, optionally specified by the time range.

Get past recommendations for an app, optionally specified by the time range.

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

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 1090
def list_history_for_web_app_next_with_http_info(next_page_link, custom_headers:nil)
  list_history_for_web_app_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_history_for_web_app_with_http_info(resource_group_name, site_name, filter:nil, custom_headers:nil) click to toggle source

Get past recommendations for an app, optionally specified by the time range.

Get past recommendations for an app, optionally specified by the time range.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 349
def list_history_for_web_app_with_http_info(resource_group_name, site_name, filter:nil, custom_headers:nil)
  list_history_for_web_app_async(resource_group_name, site_name, filter:filter, custom_headers:custom_headers).value!
end
list_next(next_page_link, custom_headers:nil) click to toggle source

List all recommendations for a subscription.

List all recommendations for a subscription.

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

@return [RecommendationCollection] operation results.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 977
def list_next(next_page_link, custom_headers:nil)
  response = list_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_next_async(next_page_link, custom_headers:nil) click to toggle source

List all recommendations for a subscription.

List all recommendations for a subscription.

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

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 1010
def list_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
list_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

List all recommendations for a subscription.

List all recommendations for a subscription.

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

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 994
def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_with_http_info(featured:nil, filter:nil, custom_headers:nil) click to toggle source

List all recommendations for a subscription.

List all recommendations for a subscription.

@param featured [Boolean] Specify true to return only the most critical recommendations. The default is false, which returns all recommendations. @param filter [String] Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration’ @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 63
def list_with_http_info(featured:nil, filter:nil, custom_headers:nil)
  list_async(featured:featured, filter:filter, custom_headers:custom_headers).value!
end
reset_all_filters(custom_headers:nil) click to toggle source

Reset all recommendation opt-out settings for a subscription.

Reset all recommendation opt-out settings for a subscription.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 147
def reset_all_filters(custom_headers:nil)
  response = reset_all_filters_async(custom_headers:custom_headers).value!
  nil
end
reset_all_filters_async(custom_headers:nil) click to toggle source

Reset all recommendation opt-out settings for a subscription.

Reset all recommendation opt-out settings for a subscription.

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

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 176
def reset_all_filters_async(custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
reset_all_filters_for_web_app(resource_group_name, site_name, custom_headers:nil) click to toggle source

Reset all recommendation opt-out settings for an app.

Reset all recommendation opt-out settings for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 661
def reset_all_filters_for_web_app(resource_group_name, site_name, custom_headers:nil)
  response = reset_all_filters_for_web_app_async(resource_group_name, site_name, custom_headers:custom_headers).value!
  nil
end
reset_all_filters_for_web_app_async(resource_group_name, site_name, custom_headers:nil) click to toggle source

Reset all recommendation opt-out settings for an app.

Reset all recommendation opt-out settings for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 696
def reset_all_filters_for_web_app_async(resource_group_name, site_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+[^\.]$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+[^\.]$$')).nil?
  fail ArgumentError, 'site_name is nil' if site_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


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

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

  request_url = @base_url || @client.base_url

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

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

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

    result
  end

  promise.execute
end
reset_all_filters_for_web_app_with_http_info(resource_group_name, site_name, custom_headers:nil) click to toggle source

Reset all recommendation opt-out settings for an app.

Reset all recommendation opt-out settings for an app.

@param resource_group_name [String] Name of the resource group to which the resource belongs. @param site_name [String] Name of the app. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 679
def reset_all_filters_for_web_app_with_http_info(resource_group_name, site_name, custom_headers:nil)
  reset_all_filters_for_web_app_async(resource_group_name, site_name, custom_headers:custom_headers).value!
end
reset_all_filters_with_http_info(custom_headers:nil) click to toggle source

Reset all recommendation opt-out settings for a subscription.

Reset all recommendation opt-out settings for a subscription.

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

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

# File lib/2016-03-01/generated/azure_mgmt_web/recommendations.rb, line 162
def reset_all_filters_with_http_info(custom_headers:nil)
  reset_all_filters_async(custom_headers:custom_headers).value!
end