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

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/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/generated/azure_mgmt_web/recommendations.rb', line 25

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientWebSiteManagementClient (readonly)

Returns reference to the WebSiteManagementClient.

Returns:



30
31
32
# File 'lib/generated/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/generated/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
142
143
144
145
146
147
148
# File 'lib/generated/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)
        result_mapper = {
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serialized_name: 'RecommendationElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Recommendation'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#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/generated/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.



390
391
392
393
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 390

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.



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
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 431

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)
        result_mapper = {
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serialized_name: 'RecommendationElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Recommendation'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#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.



411
412
413
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 411

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.



266
267
268
269
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 266

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.



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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 305

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)
        result_mapper = {
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serialized_name: 'RecommendationElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Recommendation'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

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.



286
287
288
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 286

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:



162
163
164
165
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 162

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.



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
243
244
245
246
247
248
249
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 195

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)
        result_mapper = RecommendationRule.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#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.



179
180
181
# File 'lib/generated/azure_mgmt_web/recommendations.rb', line 179

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