# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Web::Mgmt::V2016_03_01
#
# WebSite Management Client
#
class Recommendations
include MsRestAzure
#
# Creates and initializes a new instance of the Recommendations class.
# @param client service class for accessing basic functionality.
#
def initialize(client)
@client = client
end
# @return [WebSiteManagementClient] reference to the WebSiteManagementClient
attr_reader :client
#
# 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'[PT1H|PT1M|P1D]
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array] operation results.
#
def list(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 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'[PT1H|PT1M|P1D]
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_with_http_info(featured:nil, filter:nil, custom_headers:nil)
list_async(featured:featured, filter:filter, custom_headers:custom_headers).value!
end
#
# 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'[PT1H|PT1M|P1D]
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_async(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?
# 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
#
# 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.
#
#
def reset_all_filters(custom_headers:nil)
response = reset_all_filters_async(custom_headers:custom_headers).value!
nil
end
#
# 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.
#
def reset_all_filters_with_http_info(custom_headers:nil)
reset_all_filters_async(custom_headers:custom_headers).value!
end
#
# 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.
#
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
end
promise.execute
end
#
# 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.
#
#
def disable_recommendation_for_subscription(name, custom_headers:nil)
response = disable_recommendation_for_subscription_async(name, custom_headers:custom_headers).value!
nil
end
#
# 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.
#
def disable_recommendation_for_subscription_with_http_info(name, custom_headers:nil)
disable_recommendation_for_subscription_async(name, custom_headers:custom_headers).value!
end
#
# 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.
#
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
end
promise.execute
end
#
# 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'[PT1H|PT1M|P1D]
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array] operation results.
#
def list_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
#
# 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'[PT1H|PT1M|P1D]
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_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
#
# 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'[PT1H|PT1M|P1D]
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_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?
# 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
#
# Get all recommendations for an app.
#
# Get 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 featured [Boolean] Specify true
to return only the most
# critical recommendations. The default is false
, which returns
# all recommendations.
# @param filter [String] Return only channels specified in the filter. Filter
# is specified by using OData syntax. Example: $filter=channels eq 'Api' or
# channel eq 'Notification'
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array] operation results.
#
def list_recommended_rules_for_web_app(resource_group_name, site_name, featured:nil, filter:nil, custom_headers:nil)
first_page = list_recommended_rules_for_web_app_as_lazy(resource_group_name, site_name, featured:featured, filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end
#
# Get all recommendations for an app.
#
# Get 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 featured [Boolean] Specify true
to return only the most
# critical recommendations. The default is false
, which returns
# all recommendations.
# @param filter [String] Return only channels specified in the filter. Filter
# is specified by using OData syntax. Example: $filter=channels eq 'Api' or
# channel eq 'Notification'
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_recommended_rules_for_web_app_with_http_info(resource_group_name, site_name, featured:nil, filter:nil, custom_headers:nil)
list_recommended_rules_for_web_app_async(resource_group_name, site_name, featured:featured, filter:filter, custom_headers:custom_headers).value!
end
#
# Get all recommendations for an app.
#
# Get 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 featured [Boolean] Specify true
to return only the most
# critical recommendations. The default is false
, which returns
# all recommendations.
# @param filter [String] Return only channels specified in the filter. Filter
# is specified by using OData syntax. Example: $filter=channels eq 'Api' or
# channel eq 'Notification'
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_recommended_rules_for_web_app_async(resource_group_name, site_name, featured:nil, 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}/recommendations'
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: {'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?
# 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
#
# 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.
#
#
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 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.
#
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 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.
#
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
end
promise.execute
end
#
# 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.
#
#
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 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.
#
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 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.
#
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
end
promise.execute
end
#
# 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.
#
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 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.
#
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
#
# 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.
#
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?
# 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
#
# 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.
#
#
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
#
# 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.
#
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
#
# 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.
#
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
end
promise.execute
end
#
# 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.
#
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 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.
#
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 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.
#
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?
# 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
#
# 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.
#
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
#
# 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.
#
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
#
# 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.
#
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?
# 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
#
# Get all recommendations for an app.
#
# Get all recommendations for an app.
#
# @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.
#
def list_recommended_rules_for_web_app_next(next_page_link, custom_headers:nil)
response = list_recommended_rules_for_web_app_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Get all recommendations for an app.
#
# Get all recommendations for an app.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_recommended_rules_for_web_app_next_with_http_info(next_page_link, custom_headers:nil)
list_recommended_rules_for_web_app_next_async(next_page_link, custom_headers:custom_headers).value!
end
#
# Get all recommendations for an app.
#
# Get all recommendations for an app.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_recommended_rules_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?
# 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 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'[PT1H|PT1M|P1D]
# @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.
#
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
#
# 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'[PT1H|PT1M|P1D]
# @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.
#
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
#
# Get all recommendations for an app.
#
# Get 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 featured [Boolean] Specify true
to return only the most
# critical recommendations. The default is false
, which returns
# all recommendations.
# @param filter [String] Return only channels specified in the filter. Filter
# is specified by using OData syntax. Example: $filter=channels eq 'Api' or
# channel eq 'Notification'
# @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.
#
def list_recommended_rules_for_web_app_as_lazy(resource_group_name, site_name, featured:nil, filter:nil, custom_headers:nil)
response = list_recommended_rules_for_web_app_async(resource_group_name, site_name, 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_recommended_rules_for_web_app_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end
end
end