Class: Azure::ARM::Web::Recommendations

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/azure_mgmt_web/recommendations.rb

Overview

Use these APIs to manage Azure Websites resources through the Azure Resource Manager. All task operations conform to the HTTP/1.1 protocol specification and each operation returns an x-ms-request-id header that can be used to obtain information about the request. You must make sure that requests made to these resources are secure. For more information, see <a href=“msdn.microsoft.com/en-us/library/azure/dn790557.aspx”>Authenticating Azure Resource Manager requests.</a>

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Recommendations

Creates and initializes a new instance of the Recommendations class.

Parameters:

  • client

    service class for accessing basic functionality.



25
26
27
# File 'lib/azure_mgmt_web/recommendations.rb', line 25

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns reference to the WebSiteManagementClient.

Returns:

  • reference to the WebSiteManagementClient



30
31
32
# File 'lib/azure_mgmt_web/recommendations.rb', line 30

def client
  @client
end

Instance Method Details

#get_recommendation_by_subscription(featured = nil, filter = nil, custom_headers = nil) ⇒ Array

Gets a list of recommendations associated with the specified subscription.

recommendation among the others. Otherwise this API returns all recommendations available is specified by using OData syntax. Example: $filter=channels eq ‘Api’ or channel eq ‘Notification’ will be added to the HTTP request.

Parameters:

  • featured (Boolean) (defaults to: nil)

    If set, this API returns only the most critical

  • filter (String) (defaults to: nil)

    Return only channels specified in the filter. Filter

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



46
47
48
49
# File 'lib/azure_mgmt_web/recommendations.rb', line 46

def get_recommendation_by_subscription(featured = nil, filter = nil, custom_headers = nil)
  response = get_recommendation_by_subscription_async(featured, filter, custom_headers).value!
  response.body unless response.nil?
end

#get_recommendation_by_subscription_async(featured = nil, filter = nil, custom_headers = nil) ⇒ Concurrent::Promise

Gets a list of recommendations associated with the specified subscription.

recommendation among the others. Otherwise this API returns all recommendations available is specified by using OData syntax. Example: $filter=channels eq ‘Api’ or channel eq ‘Notification’ to the HTTP request.

Parameters:

  • featured (Boolean) (defaults to: nil)

    If set, this API returns only the most critical

  • filter (String) (defaults to: nil)

    Return only channels specified in the filter. Filter

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/azure_mgmt_web/recommendations.rb', line 83

def get_recommendation_by_subscription_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 = {}

  # 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'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'featured' => featured,'$filter' => filter,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        unless parsed_response.nil?
          deserialized_array = []
          parsed_response.each do |element|
            unless element.nil?
              element = Recommendation.deserialize_object(element)
            end
            deserialized_array.push(element)
          end
          parsed_response = deserialized_array
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_recommendation_by_subscription_with_http_info(featured = nil, filter = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a list of recommendations associated with the specified subscription.

recommendation among the others. Otherwise this API returns all recommendations available is specified by using OData syntax. Example: $filter=channels eq ‘Api’ or channel eq ‘Notification’ will be added to the HTTP request.

Parameters:

  • featured (Boolean) (defaults to: nil)

    If set, this API returns only the most critical

  • filter (String) (defaults to: nil)

    Return only channels specified in the filter. Filter

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



65
66
67
# File 'lib/azure_mgmt_web/recommendations.rb', line 65

def get_recommendation_by_subscription_with_http_info(featured = nil, filter = nil, custom_headers = nil)
  get_recommendation_by_subscription_async(featured, filter, custom_headers).value!
end

#get_recommendation_history_for_site(resource_group_name, site_name, start_time = nil, end_time = nil, custom_headers = nil) ⇒ Array

Gets the list of past recommendations optionally specified by the time range.

$filter=startTime eq ‘2015-01-01T00:00:00Z’ and endTime eq ‘2015-01-02T00:00:00Z’ $filter=startTime eq ‘2015-01-01T00:00:00Z’ and endTime eq ‘2015-01-02T00:00:00Z’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • start_time (String) (defaults to: nil)

    The start time of a time range to query, e.g.

  • end_time (String) (defaults to: nil)

    The end time of a time range to query, e.g.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



376
377
378
379
# File 'lib/azure_mgmt_web/recommendations.rb', line 376

def get_recommendation_history_for_site(resource_group_name, site_name, start_time = nil, end_time = nil, custom_headers = nil)
  response = get_recommendation_history_for_site_async(resource_group_name, site_name, start_time, end_time, custom_headers).value!
  response.body unless response.nil?
end

#get_recommendation_history_for_site_async(resource_group_name, site_name, start_time = nil, end_time = nil, custom_headers = nil) ⇒ Concurrent::Promise

Gets the list of past recommendations optionally specified by the time range.

$filter=startTime eq ‘2015-01-01T00:00:00Z’ and endTime eq ‘2015-01-02T00:00:00Z’ $filter=startTime eq ‘2015-01-01T00:00:00Z’ and endTime eq ‘2015-01-02T00:00:00Z’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • start_time (String) (defaults to: nil)

    The start time of a time range to query, e.g.

  • end_time (String) (defaults to: nil)

    The end time of a time range to query, e.g.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/azure_mgmt_web/recommendations.rb', line 417

def get_recommendation_history_for_site_async(resource_group_name, site_name, start_time = nil, end_time = nil, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.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 = {}

  # 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'
  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: {'startTime' => start_time,'endTime' => end_time,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        unless parsed_response.nil?
          deserialized_array = []
          parsed_response.each do |element|
            unless element.nil?
              element = Recommendation.deserialize_object(element)
            end
            deserialized_array.push(element)
          end
          parsed_response = deserialized_array
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_recommendation_history_for_site_with_http_info(resource_group_name, site_name, start_time = nil, end_time = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the list of past recommendations optionally specified by the time range.

$filter=startTime eq ‘2015-01-01T00:00:00Z’ and endTime eq ‘2015-01-02T00:00:00Z’ $filter=startTime eq ‘2015-01-01T00:00:00Z’ and endTime eq ‘2015-01-02T00:00:00Z’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • start_time (String) (defaults to: nil)

    The start time of a time range to query, e.g.

  • end_time (String) (defaults to: nil)

    The end time of a time range to query, e.g.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



397
398
399
# File 'lib/azure_mgmt_web/recommendations.rb', line 397

def get_recommendation_history_for_site_with_http_info(resource_group_name, site_name, start_time = nil, end_time = nil, custom_headers = nil)
  get_recommendation_history_for_site_async(resource_group_name, site_name, start_time, end_time, custom_headers).value!
end

Gets a list of recommendations associated with the specified web site.

recommendation among the others. Otherwise this API returns all recommendations available will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • featured (Boolean) (defaults to: nil)

    If set, this API returns only the most critical

  • site_sku (String) (defaults to: nil)

    The name of site SKU.

  • num_slots (Integer) (defaults to: nil)

    The number of site slots associated to the site

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



259
260
261
262
# File 'lib/azure_mgmt_web/recommendations.rb', line 259

def get_recommended_rules_for_site(resource_group_name, site_name, featured = nil, site_sku = nil, num_slots = nil, custom_headers = nil)
  response = get_recommended_rules_for_site_async(resource_group_name, site_name, featured, site_sku, num_slots, custom_headers).value!
  response.body unless response.nil?
end

Gets a list of recommendations associated with the specified web site.

recommendation among the others. Otherwise this API returns all recommendations available to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • featured (Boolean) (defaults to: nil)

    If set, this API returns only the most critical

  • site_sku (String) (defaults to: nil)

    The name of site SKU.

  • num_slots (Integer) (defaults to: nil)

    The number of site slots associated to the site

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/azure_mgmt_web/recommendations.rb', line 298

def get_recommended_rules_for_site_async(resource_group_name, site_name, featured = nil, site_sku = nil, num_slots = nil, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.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 = {}

  # 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'
  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,'siteSku' => site_sku,'numSlots' => num_slots,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        unless parsed_response.nil?
          deserialized_array = []
          parsed_response.each do |element|
            unless element.nil?
              element = Recommendation.deserialize_object(element)
            end
            deserialized_array.push(element)
          end
          parsed_response = deserialized_array
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

Gets a list of recommendations associated with the specified web site.

recommendation among the others. Otherwise this API returns all recommendations available will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • featured (Boolean) (defaults to: nil)

    If set, this API returns only the most critical

  • site_sku (String) (defaults to: nil)

    The name of site SKU.

  • num_slots (Integer) (defaults to: nil)

    The number of site slots associated to the site

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



279
280
281
# File 'lib/azure_mgmt_web/recommendations.rb', line 279

def get_recommended_rules_for_site_with_http_info(resource_group_name, site_name, featured = nil, site_sku = nil, num_slots = nil, custom_headers = nil)
  get_recommended_rules_for_site_async(resource_group_name, site_name, featured, site_sku, num_slots, custom_headers).value!
end

#get_rule_details_by_site_name(resource_group_name, site_name, name, custom_headers = nil) ⇒ RecommendationRule

Gets the detailed properties of the recommendation object for the specified web site.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • name (String)

    Recommendation rule name

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



155
156
157
158
# File 'lib/azure_mgmt_web/recommendations.rb', line 155

def get_rule_details_by_site_name(resource_group_name, site_name, name, custom_headers = nil)
  response = get_rule_details_by_site_name_async(resource_group_name, site_name, name, custom_headers).value!
  response.body unless response.nil?
end

#get_rule_details_by_site_name_async(resource_group_name, site_name, name, custom_headers = nil) ⇒ Concurrent::Promise

Gets the detailed properties of the recommendation object for the specified web site.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • name (String)

    Recommendation rule name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/azure_mgmt_web/recommendations.rb', line 188

def get_rule_details_by_site_name_async(resource_group_name, site_name, name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.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 = {}

  # 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}'
  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 || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

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

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        unless parsed_response.nil?
          parsed_response = RecommendationRule.deserialize_object(parsed_response)
        end
        result.body = parsed_response
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_rule_details_by_site_name_with_http_info(resource_group_name, site_name, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the detailed properties of the recommendation object for the specified web site.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    Resource group name

  • site_name (String)

    Site name

  • name (String)

    Recommendation rule name

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



172
173
174
# File 'lib/azure_mgmt_web/recommendations.rb', line 172

def get_rule_details_by_site_name_with_http_info(resource_group_name, site_name, name, custom_headers = nil)
  get_rule_details_by_site_name_async(resource_group_name, site_name, name, custom_headers).value!
end