azure_mgmt_advisor 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor.rb +41 -0
  4. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/advisor_management_client.rb +140 -0
  5. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/category.rb +18 -0
  6. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/impact.rb +17 -0
  7. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
  8. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
  9. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
  10. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/resource.rb +111 -0
  11. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +201 -0
  12. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
  13. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/risk.rb +17 -0
  14. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
  15. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/models/suppression_contract.rb +109 -0
  16. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/module_definition.rb +9 -0
  17. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/operations.rb +215 -0
  18. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/recommendations.rb +503 -0
  19. data/lib/2016-07-12-preview/generated/azure_mgmt_advisor/suppressions.rb +437 -0
  20. data/lib/2017-03-31/generated/azure_mgmt_advisor.rb +41 -0
  21. data/lib/2017-03-31/generated/azure_mgmt_advisor/advisor_management_client.rb +140 -0
  22. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/category.rb +18 -0
  23. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/impact.rb +17 -0
  24. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
  25. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
  26. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
  27. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/resource.rb +80 -0
  28. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +193 -0
  29. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
  30. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/risk.rb +17 -0
  31. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
  32. data/lib/2017-03-31/generated/azure_mgmt_advisor/models/suppression_contract.rb +85 -0
  33. data/lib/2017-03-31/generated/azure_mgmt_advisor/module_definition.rb +9 -0
  34. data/lib/2017-03-31/generated/azure_mgmt_advisor/operations.rb +215 -0
  35. data/lib/2017-03-31/generated/azure_mgmt_advisor/recommendations.rb +503 -0
  36. data/lib/2017-03-31/generated/azure_mgmt_advisor/suppressions.rb +437 -0
  37. data/lib/2017-04-19/generated/azure_mgmt_advisor.rb +47 -0
  38. data/lib/2017-04-19/generated/azure_mgmt_advisor/advisor_management_client.rb +144 -0
  39. data/lib/2017-04-19/generated/azure_mgmt_advisor/configurations.rb +535 -0
  40. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/armerror_response_body.rb +59 -0
  41. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/category.rb +18 -0
  42. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/config_data.rb +80 -0
  43. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/config_data_properties.rb +79 -0
  44. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/configuration_list_result.rb +98 -0
  45. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/impact.rb +17 -0
  46. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/operation_display_info.rb +80 -0
  47. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/operation_entity.rb +58 -0
  48. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/operation_entity_list_result.rb +98 -0
  49. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/resource.rb +80 -0
  50. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/resource_recommendation_base.rb +212 -0
  51. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/resource_recommendation_base_list_result.rb +99 -0
  52. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/risk.rb +17 -0
  53. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/short_description.rb +59 -0
  54. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/suppression_contract.rb +85 -0
  55. data/lib/2017-04-19/generated/azure_mgmt_advisor/models/suppression_contract_list_result.rb +98 -0
  56. data/lib/2017-04-19/generated/azure_mgmt_advisor/module_definition.rb +9 -0
  57. data/lib/2017-04-19/generated/azure_mgmt_advisor/operations.rb +215 -0
  58. data/lib/2017-04-19/generated/azure_mgmt_advisor/recommendations.rb +503 -0
  59. data/lib/2017-04-19/generated/azure_mgmt_advisor/suppressions.rb +553 -0
  60. data/lib/azure_mgmt_advisor.rb +8 -0
  61. data/lib/module_definition.rb +7 -0
  62. data/lib/profiles/latest/advisor_latest_profile_client.rb +40 -0
  63. data/lib/profiles/latest/advisor_module_definition.rb +8 -0
  64. data/lib/profiles/latest/modules/advisor_profile_module.rb +131 -0
  65. data/lib/version.rb +7 -0
  66. metadata +182 -0
@@ -0,0 +1,553 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Advisor::Mgmt::V2017_04_19
7
+ #
8
+ # REST APIs for Azure Advisor
9
+ #
10
+ class Suppressions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Suppressions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AdvisorManagementClient] reference to the AdvisorManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Obtains the details of a suppression.
26
+ #
27
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
28
+ # identifier of the resource to which the recommendation applies.
29
+ # @param recommendation_id [String] The recommendation ID.
30
+ # @param name [String] The name of the suppression.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [SuppressionContract] operation results.
35
+ #
36
+ def get(resource_uri, recommendation_id, name, custom_headers:nil)
37
+ response = get_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Obtains the details of a suppression.
43
+ #
44
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
45
+ # identifier of the resource to which the recommendation applies.
46
+ # @param recommendation_id [String] The recommendation ID.
47
+ # @param name [String] The name of the suppression.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def get_with_http_info(resource_uri, recommendation_id, name, custom_headers:nil)
54
+ get_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Obtains the details of a suppression.
59
+ #
60
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
61
+ # identifier of the resource to which the recommendation applies.
62
+ # @param recommendation_id [String] The recommendation ID.
63
+ # @param name [String] The name of the suppression.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def get_async(resource_uri, recommendation_id, name, custom_headers:nil)
70
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
71
+ fail ArgumentError, 'recommendation_id is nil' if recommendation_id.nil?
72
+ fail ArgumentError, 'name is nil' if name.nil?
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+
75
+
76
+ request_headers = {}
77
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = '{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'
83
+
84
+ request_url = @base_url || @client.base_url
85
+
86
+ options = {
87
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
88
+ path_params: {'resourceUri' => resource_uri,'recommendationId' => recommendation_id,'name' => name},
89
+ query_params: {'api-version' => @client.api_version},
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:get, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 200
100
+ error_model = JSON.load(response_content)
101
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ # Deserialize Response
106
+ if status_code == 200
107
+ begin
108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
109
+ result_mapper = Azure::Advisor::Mgmt::V2017_04_19::Models::SuppressionContract.mapper()
110
+ result.body = @client.deserialize(result_mapper, parsed_response)
111
+ rescue Exception => e
112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
113
+ end
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ promise.execute
120
+ end
121
+
122
+ #
123
+ # Enables the snoozed or dismissed attribute of a recommendation. The snoozed
124
+ # or dismissed attribute is referred to as a suppression. Use this API to
125
+ # create or update the snoozed or dismissed status of a recommendation.
126
+ #
127
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
128
+ # identifier of the resource to which the recommendation applies.
129
+ # @param recommendation_id [String] The recommendation ID.
130
+ # @param name [String] The name of the suppression.
131
+ # @param suppression_contract [SuppressionContract] The snoozed or dismissed
132
+ # attribute; for example, the snooze duration.
133
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
134
+ # will be added to the HTTP request.
135
+ #
136
+ # @return [SuppressionContract] operation results.
137
+ #
138
+ def create(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
139
+ response = create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:custom_headers).value!
140
+ response.body unless response.nil?
141
+ end
142
+
143
+ #
144
+ # Enables the snoozed or dismissed attribute of a recommendation. The snoozed
145
+ # or dismissed attribute is referred to as a suppression. Use this API to
146
+ # create or update the snoozed or dismissed status of a recommendation.
147
+ #
148
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
149
+ # identifier of the resource to which the recommendation applies.
150
+ # @param recommendation_id [String] The recommendation ID.
151
+ # @param name [String] The name of the suppression.
152
+ # @param suppression_contract [SuppressionContract] The snoozed or dismissed
153
+ # attribute; for example, the snooze duration.
154
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
155
+ # will be added to the HTTP request.
156
+ #
157
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
158
+ #
159
+ def create_with_http_info(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
160
+ create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:custom_headers).value!
161
+ end
162
+
163
+ #
164
+ # Enables the snoozed or dismissed attribute of a recommendation. The snoozed
165
+ # or dismissed attribute is referred to as a suppression. Use this API to
166
+ # create or update the snoozed or dismissed status of a recommendation.
167
+ #
168
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
169
+ # identifier of the resource to which the recommendation applies.
170
+ # @param recommendation_id [String] The recommendation ID.
171
+ # @param name [String] The name of the suppression.
172
+ # @param suppression_contract [SuppressionContract] The snoozed or dismissed
173
+ # attribute; for example, the snooze duration.
174
+ # @param [Hash{String => String}] A hash of custom headers that will be added
175
+ # to the HTTP request.
176
+ #
177
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
178
+ #
179
+ def create_async(resource_uri, recommendation_id, name, suppression_contract, custom_headers:nil)
180
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
181
+ fail ArgumentError, 'recommendation_id is nil' if recommendation_id.nil?
182
+ fail ArgumentError, 'name is nil' if name.nil?
183
+ fail ArgumentError, 'suppression_contract is nil' if suppression_contract.nil?
184
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
185
+
186
+
187
+ request_headers = {}
188
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
189
+
190
+ # Set Headers
191
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
192
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
193
+
194
+ # Serialize Request
195
+ request_mapper = Azure::Advisor::Mgmt::V2017_04_19::Models::SuppressionContract.mapper()
196
+ request_content = @client.serialize(request_mapper, suppression_contract)
197
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
198
+
199
+ path_template = '{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'
200
+
201
+ request_url = @base_url || @client.base_url
202
+
203
+ options = {
204
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
205
+ path_params: {'resourceUri' => resource_uri,'recommendationId' => recommendation_id,'name' => name},
206
+ query_params: {'api-version' => @client.api_version},
207
+ body: request_content,
208
+ headers: request_headers.merge(custom_headers || {}),
209
+ base_url: request_url
210
+ }
211
+ promise = @client.make_request_async(:put, path_template, options)
212
+
213
+ promise = promise.then do |result|
214
+ http_response = result.response
215
+ status_code = http_response.status
216
+ response_content = http_response.body
217
+ unless status_code == 200
218
+ error_model = JSON.load(response_content)
219
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
220
+ end
221
+
222
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
223
+ # Deserialize Response
224
+ if status_code == 200
225
+ begin
226
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
227
+ result_mapper = Azure::Advisor::Mgmt::V2017_04_19::Models::SuppressionContract.mapper()
228
+ result.body = @client.deserialize(result_mapper, parsed_response)
229
+ rescue Exception => e
230
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
231
+ end
232
+ end
233
+
234
+ result
235
+ end
236
+
237
+ promise.execute
238
+ end
239
+
240
+ #
241
+ # Enables the activation of a snoozed or dismissed recommendation. The snoozed
242
+ # or dismissed attribute of a recommendation is referred to as a suppression.
243
+ #
244
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
245
+ # identifier of the resource to which the recommendation applies.
246
+ # @param recommendation_id [String] The recommendation ID.
247
+ # @param name [String] The name of the suppression.
248
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
249
+ # will be added to the HTTP request.
250
+ #
251
+ #
252
+ def delete(resource_uri, recommendation_id, name, custom_headers:nil)
253
+ response = delete_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
254
+ nil
255
+ end
256
+
257
+ #
258
+ # Enables the activation of a snoozed or dismissed recommendation. The snoozed
259
+ # or dismissed attribute of a recommendation is referred to as a suppression.
260
+ #
261
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
262
+ # identifier of the resource to which the recommendation applies.
263
+ # @param recommendation_id [String] The recommendation ID.
264
+ # @param name [String] The name of the suppression.
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
269
+ #
270
+ def delete_with_http_info(resource_uri, recommendation_id, name, custom_headers:nil)
271
+ delete_async(resource_uri, recommendation_id, name, custom_headers:custom_headers).value!
272
+ end
273
+
274
+ #
275
+ # Enables the activation of a snoozed or dismissed recommendation. The snoozed
276
+ # or dismissed attribute of a recommendation is referred to as a suppression.
277
+ #
278
+ # @param resource_uri [String] The fully qualified Azure Resource Manager
279
+ # identifier of the resource to which the recommendation applies.
280
+ # @param recommendation_id [String] The recommendation ID.
281
+ # @param name [String] The name of the suppression.
282
+ # @param [Hash{String => String}] A hash of custom headers that will be added
283
+ # to the HTTP request.
284
+ #
285
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
286
+ #
287
+ def delete_async(resource_uri, recommendation_id, name, custom_headers:nil)
288
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
289
+ fail ArgumentError, 'recommendation_id is nil' if recommendation_id.nil?
290
+ fail ArgumentError, 'name is nil' if name.nil?
291
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
292
+
293
+
294
+ request_headers = {}
295
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
296
+
297
+ # Set Headers
298
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
299
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
300
+ path_template = '{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}'
301
+
302
+ request_url = @base_url || @client.base_url
303
+
304
+ options = {
305
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
306
+ path_params: {'resourceUri' => resource_uri,'recommendationId' => recommendation_id,'name' => name},
307
+ query_params: {'api-version' => @client.api_version},
308
+ headers: request_headers.merge(custom_headers || {}),
309
+ base_url: request_url
310
+ }
311
+ promise = @client.make_request_async(:delete, path_template, options)
312
+
313
+ promise = promise.then do |result|
314
+ http_response = result.response
315
+ status_code = http_response.status
316
+ response_content = http_response.body
317
+ unless status_code == 204
318
+ error_model = JSON.load(response_content)
319
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
320
+ end
321
+
322
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
323
+
324
+ result
325
+ end
326
+
327
+ promise.execute
328
+ end
329
+
330
+ #
331
+ # Retrieves the list of snoozed or dismissed suppressions for a subscription.
332
+ # The snoozed or dismissed attribute of a recommendation is referred to as a
333
+ # suppression.
334
+ #
335
+ # @param top [Integer] The number of suppressions per page if a paged version
336
+ # of this API is being used.
337
+ # @param skip_token [String] The page-continuation token to use with a paged
338
+ # version of this API.
339
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
340
+ # will be added to the HTTP request.
341
+ #
342
+ # @return [Array<SuppressionContract>] operation results.
343
+ #
344
+ def list(top:nil, skip_token:nil, custom_headers:nil)
345
+ first_page = list_as_lazy(top:top, skip_token:skip_token, custom_headers:custom_headers)
346
+ first_page.get_all_items
347
+ end
348
+
349
+ #
350
+ # Retrieves the list of snoozed or dismissed suppressions for a subscription.
351
+ # The snoozed or dismissed attribute of a recommendation is referred to as a
352
+ # suppression.
353
+ #
354
+ # @param top [Integer] The number of suppressions per page if a paged version
355
+ # of this API is being used.
356
+ # @param skip_token [String] The page-continuation token to use with a paged
357
+ # version of this API.
358
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
359
+ # will be added to the HTTP request.
360
+ #
361
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
362
+ #
363
+ def list_with_http_info(top:nil, skip_token:nil, custom_headers:nil)
364
+ list_async(top:top, skip_token:skip_token, custom_headers:custom_headers).value!
365
+ end
366
+
367
+ #
368
+ # Retrieves the list of snoozed or dismissed suppressions for a subscription.
369
+ # The snoozed or dismissed attribute of a recommendation is referred to as a
370
+ # suppression.
371
+ #
372
+ # @param top [Integer] The number of suppressions per page if a paged version
373
+ # of this API is being used.
374
+ # @param skip_token [String] The page-continuation token to use with a paged
375
+ # version of this API.
376
+ # @param [Hash{String => String}] A hash of custom headers that will be added
377
+ # to the HTTP request.
378
+ #
379
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
380
+ #
381
+ def list_async(top:nil, skip_token:nil, custom_headers:nil)
382
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
383
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
384
+
385
+
386
+ request_headers = {}
387
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
388
+
389
+ # Set Headers
390
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
391
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
392
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions'
393
+
394
+ request_url = @base_url || @client.base_url
395
+
396
+ options = {
397
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
398
+ path_params: {'subscriptionId' => @client.subscription_id},
399
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$skipToken' => skip_token},
400
+ headers: request_headers.merge(custom_headers || {}),
401
+ base_url: request_url
402
+ }
403
+ promise = @client.make_request_async(:get, path_template, options)
404
+
405
+ promise = promise.then do |result|
406
+ http_response = result.response
407
+ status_code = http_response.status
408
+ response_content = http_response.body
409
+ unless status_code == 200
410
+ error_model = JSON.load(response_content)
411
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
412
+ end
413
+
414
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
415
+ # Deserialize Response
416
+ if status_code == 200
417
+ begin
418
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
419
+ result_mapper = Azure::Advisor::Mgmt::V2017_04_19::Models::SuppressionContractListResult.mapper()
420
+ result.body = @client.deserialize(result_mapper, parsed_response)
421
+ rescue Exception => e
422
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
423
+ end
424
+ end
425
+
426
+ result
427
+ end
428
+
429
+ promise.execute
430
+ end
431
+
432
+ #
433
+ # Retrieves the list of snoozed or dismissed suppressions for a subscription.
434
+ # The snoozed or dismissed attribute of a recommendation is referred to as a
435
+ # suppression.
436
+ #
437
+ # @param next_page_link [String] The NextLink from the previous successful call
438
+ # to List operation.
439
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
440
+ # will be added to the HTTP request.
441
+ #
442
+ # @return [SuppressionContractListResult] operation results.
443
+ #
444
+ def list_next(next_page_link, custom_headers:nil)
445
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
446
+ response.body unless response.nil?
447
+ end
448
+
449
+ #
450
+ # Retrieves the list of snoozed or dismissed suppressions for a subscription.
451
+ # The snoozed or dismissed attribute of a recommendation is referred to as a
452
+ # suppression.
453
+ #
454
+ # @param next_page_link [String] The NextLink from the previous successful call
455
+ # to List operation.
456
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
457
+ # will be added to the HTTP request.
458
+ #
459
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
460
+ #
461
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
462
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
463
+ end
464
+
465
+ #
466
+ # Retrieves the list of snoozed or dismissed suppressions for a subscription.
467
+ # The snoozed or dismissed attribute of a recommendation is referred to as a
468
+ # suppression.
469
+ #
470
+ # @param next_page_link [String] The NextLink from the previous successful call
471
+ # to List operation.
472
+ # @param [Hash{String => String}] A hash of custom headers that will be added
473
+ # to the HTTP request.
474
+ #
475
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
476
+ #
477
+ def list_next_async(next_page_link, custom_headers:nil)
478
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
479
+
480
+
481
+ request_headers = {}
482
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
483
+
484
+ # Set Headers
485
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
486
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
487
+ path_template = '{nextLink}'
488
+
489
+ request_url = @base_url || @client.base_url
490
+
491
+ options = {
492
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
493
+ skip_encoding_path_params: {'nextLink' => next_page_link},
494
+ headers: request_headers.merge(custom_headers || {}),
495
+ base_url: request_url
496
+ }
497
+ promise = @client.make_request_async(:get, path_template, options)
498
+
499
+ promise = promise.then do |result|
500
+ http_response = result.response
501
+ status_code = http_response.status
502
+ response_content = http_response.body
503
+ unless status_code == 200
504
+ error_model = JSON.load(response_content)
505
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
506
+ end
507
+
508
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
509
+ # Deserialize Response
510
+ if status_code == 200
511
+ begin
512
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
513
+ result_mapper = Azure::Advisor::Mgmt::V2017_04_19::Models::SuppressionContractListResult.mapper()
514
+ result.body = @client.deserialize(result_mapper, parsed_response)
515
+ rescue Exception => e
516
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
517
+ end
518
+ end
519
+
520
+ result
521
+ end
522
+
523
+ promise.execute
524
+ end
525
+
526
+ #
527
+ # Retrieves the list of snoozed or dismissed suppressions for a subscription.
528
+ # The snoozed or dismissed attribute of a recommendation is referred to as a
529
+ # suppression.
530
+ #
531
+ # @param top [Integer] The number of suppressions per page if a paged version
532
+ # of this API is being used.
533
+ # @param skip_token [String] The page-continuation token to use with a paged
534
+ # version of this API.
535
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
536
+ # will be added to the HTTP request.
537
+ #
538
+ # @return [SuppressionContractListResult] which provide lazy access to pages of
539
+ # the response.
540
+ #
541
+ def list_as_lazy(top:nil, skip_token:nil, custom_headers:nil)
542
+ response = list_async(top:top, skip_token:skip_token, custom_headers:custom_headers).value!
543
+ unless response.nil?
544
+ page = response.body
545
+ page.next_method = Proc.new do |next_page_link|
546
+ list_next_async(next_page_link, custom_headers:custom_headers)
547
+ end
548
+ page
549
+ end
550
+ end
551
+
552
+ end
553
+ end