azure_mgmt_policy_insights 0.17.0 → 0.17.1

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 (39) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_columns.rb +1 -1
  3. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_columns.rb +1 -1
  4. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  5. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +1 -1
  6. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +1 -1
  7. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  8. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +1 -1
  9. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +1 -1
  10. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  11. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_event.rb +1 -1
  12. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_state.rb +1 -1
  13. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +2 -0
  14. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  15. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights.rb +45 -0
  16. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_definition.rb +115 -0
  17. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_response.rb +47 -0
  18. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_details.rb +108 -0
  19. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resource.rb +102 -0
  20. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resources_query_results.rb +100 -0
  21. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  22. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +60 -0
  23. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +54 -0
  24. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation.rb +158 -0
  25. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment.rb +124 -0
  26. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment_summary.rb +72 -0
  27. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployments_list_result.rb +101 -0
  28. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_filters.rb +55 -0
  29. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_list_result.rb +100 -0
  30. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/tracked_resource_modification_details.rb +76 -0
  31. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/typed_error_info.rb +59 -0
  32. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  33. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  34. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb +860 -0
  35. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb +3230 -0
  36. data/lib/azure_mgmt_policy_insights.rb +1 -0
  37. data/lib/profiles/latest/modules/policyinsights_profile_module.rb +78 -14
  38. data/lib/version.rb +1 -1
  39. metadata +24 -3
@@ -0,0 +1,3230 @@
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::PolicyInsights::Mgmt::V2018_07_01_preview
7
+ #
8
+ # Remediations
9
+ #
10
+ class Remediations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Remediations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [PolicyInsightsClient] reference to the PolicyInsightsClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets all deployments for a remediation at management group scope.
26
+ #
27
+ # @param management_group_id [String] Management group ID.
28
+ # @param remediation_name [String] The name of the remediation.
29
+ # @param query_options [QueryOptions] Additional parameters for the operation
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<RemediationDeployment>] operation results.
34
+ #
35
+ def list_deployments_at_management_group(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
36
+ first_page = list_deployments_at_management_group_as_lazy(management_group_id, remediation_name, query_options:query_options, custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Gets all deployments for a remediation at management group scope.
42
+ #
43
+ # @param management_group_id [String] Management group ID.
44
+ # @param remediation_name [String] The name of the remediation.
45
+ # @param query_options [QueryOptions] Additional parameters for the operation
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_deployments_at_management_group_with_http_info(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
52
+ list_deployments_at_management_group_async(management_group_id, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Gets all deployments for a remediation at management group scope.
57
+ #
58
+ # @param management_group_id [String] Management group ID.
59
+ # @param remediation_name [String] The name of the remediation.
60
+ # @param query_options [QueryOptions] Additional parameters for the operation
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_deployments_at_management_group_async(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
67
+ management_groups_namespace = 'Microsoft.Management'
68
+ fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
69
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
70
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
71
+
72
+ top = nil
73
+ unless query_options.nil?
74
+ top = query_options.Top
75
+ end
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
90
+ query_params: {'api-version' => @client.api_version,'$top' => top},
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:post, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ # Deserialize Response
107
+ if status_code == 200
108
+ begin
109
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
110
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
111
+ result.body = @client.deserialize(result_mapper, parsed_response)
112
+ rescue Exception => e
113
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
114
+ end
115
+ end
116
+
117
+ result
118
+ end
119
+
120
+ promise.execute
121
+ end
122
+
123
+ #
124
+ # Cancels a remediation at management group scope.
125
+ #
126
+ # @param management_group_id [String] Management group ID.
127
+ # @param remediation_name [String] The name of the remediation.
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [Remediation] operation results.
132
+ #
133
+ def cancel_at_management_group(management_group_id, remediation_name, custom_headers:nil)
134
+ response = cancel_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
135
+ response.body unless response.nil?
136
+ end
137
+
138
+ #
139
+ # Cancels a remediation at management group scope.
140
+ #
141
+ # @param management_group_id [String] Management group ID.
142
+ # @param remediation_name [String] The name of the remediation.
143
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
144
+ # will be added to the HTTP request.
145
+ #
146
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
147
+ #
148
+ def cancel_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil)
149
+ cancel_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
150
+ end
151
+
152
+ #
153
+ # Cancels a remediation at management group scope.
154
+ #
155
+ # @param management_group_id [String] Management group ID.
156
+ # @param remediation_name [String] The name of the remediation.
157
+ # @param [Hash{String => String}] A hash of custom headers that will be added
158
+ # to the HTTP request.
159
+ #
160
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
161
+ #
162
+ def cancel_at_management_group_async(management_group_id, remediation_name, custom_headers:nil)
163
+ management_groups_namespace = 'Microsoft.Management'
164
+ fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
165
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
166
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
167
+
168
+
169
+ request_headers = {}
170
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
171
+
172
+ # Set Headers
173
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
174
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
175
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel'
176
+
177
+ request_url = @base_url || @client.base_url
178
+
179
+ options = {
180
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
181
+ path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
182
+ query_params: {'api-version' => @client.api_version},
183
+ headers: request_headers.merge(custom_headers || {}),
184
+ base_url: request_url
185
+ }
186
+ promise = @client.make_request_async(:post, path_template, options)
187
+
188
+ promise = promise.then do |result|
189
+ http_response = result.response
190
+ status_code = http_response.status
191
+ response_content = http_response.body
192
+ unless status_code == 200
193
+ error_model = JSON.load(response_content)
194
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
195
+ end
196
+
197
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
198
+ # Deserialize Response
199
+ if status_code == 200
200
+ begin
201
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
202
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
203
+ result.body = @client.deserialize(result_mapper, parsed_response)
204
+ rescue Exception => e
205
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
206
+ end
207
+ end
208
+
209
+ result
210
+ end
211
+
212
+ promise.execute
213
+ end
214
+
215
+ #
216
+ # Gets all remediations for the management group.
217
+ #
218
+ # @param management_group_id [String] Management group ID.
219
+ # @param query_options [QueryOptions] Additional parameters for the operation
220
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
221
+ # will be added to the HTTP request.
222
+ #
223
+ # @return [Array<Remediation>] operation results.
224
+ #
225
+ def list_for_management_group(management_group_id, query_options:nil, custom_headers:nil)
226
+ first_page = list_for_management_group_as_lazy(management_group_id, query_options:query_options, custom_headers:custom_headers)
227
+ first_page.get_all_items
228
+ end
229
+
230
+ #
231
+ # Gets all remediations for the management group.
232
+ #
233
+ # @param management_group_id [String] Management group ID.
234
+ # @param query_options [QueryOptions] Additional parameters for the operation
235
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
236
+ # will be added to the HTTP request.
237
+ #
238
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
239
+ #
240
+ def list_for_management_group_with_http_info(management_group_id, query_options:nil, custom_headers:nil)
241
+ list_for_management_group_async(management_group_id, query_options:query_options, custom_headers:custom_headers).value!
242
+ end
243
+
244
+ #
245
+ # Gets all remediations for the management group.
246
+ #
247
+ # @param management_group_id [String] Management group ID.
248
+ # @param query_options [QueryOptions] Additional parameters for the operation
249
+ # @param [Hash{String => String}] A hash of custom headers that will be added
250
+ # to the HTTP request.
251
+ #
252
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
253
+ #
254
+ def list_for_management_group_async(management_group_id, query_options:nil, custom_headers:nil)
255
+ management_groups_namespace = 'Microsoft.Management'
256
+ fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
257
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
258
+
259
+ top = nil
260
+ filter = nil
261
+ unless query_options.nil?
262
+ top = query_options.Top
263
+ end
264
+ unless query_options.nil?
265
+ filter = query_options.Filter
266
+ end
267
+
268
+ request_headers = {}
269
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
270
+
271
+ # Set Headers
272
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
273
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
274
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations'
275
+
276
+ request_url = @base_url || @client.base_url
277
+
278
+ options = {
279
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
280
+ path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id},
281
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
282
+ headers: request_headers.merge(custom_headers || {}),
283
+ base_url: request_url
284
+ }
285
+ promise = @client.make_request_async(:get, path_template, options)
286
+
287
+ promise = promise.then do |result|
288
+ http_response = result.response
289
+ status_code = http_response.status
290
+ response_content = http_response.body
291
+ unless status_code == 200
292
+ error_model = JSON.load(response_content)
293
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
294
+ end
295
+
296
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
297
+ # Deserialize Response
298
+ if status_code == 200
299
+ begin
300
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
301
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
302
+ result.body = @client.deserialize(result_mapper, parsed_response)
303
+ rescue Exception => e
304
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
305
+ end
306
+ end
307
+
308
+ result
309
+ end
310
+
311
+ promise.execute
312
+ end
313
+
314
+ #
315
+ # Creates or updates a remediation at management group scope.
316
+ #
317
+ # @param management_group_id [String] Management group ID.
318
+ # @param remediation_name [String] The name of the remediation.
319
+ # @param parameters [Remediation] The remediation parameters.
320
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
321
+ # will be added to the HTTP request.
322
+ #
323
+ # @return [Remediation] operation results.
324
+ #
325
+ def create_or_update_at_management_group(management_group_id, remediation_name, parameters, custom_headers:nil)
326
+ response = create_or_update_at_management_group_async(management_group_id, remediation_name, parameters, custom_headers:custom_headers).value!
327
+ response.body unless response.nil?
328
+ end
329
+
330
+ #
331
+ # Creates or updates a remediation at management group scope.
332
+ #
333
+ # @param management_group_id [String] Management group ID.
334
+ # @param remediation_name [String] The name of the remediation.
335
+ # @param parameters [Remediation] The remediation parameters.
336
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
337
+ # will be added to the HTTP request.
338
+ #
339
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
340
+ #
341
+ def create_or_update_at_management_group_with_http_info(management_group_id, remediation_name, parameters, custom_headers:nil)
342
+ create_or_update_at_management_group_async(management_group_id, remediation_name, parameters, custom_headers:custom_headers).value!
343
+ end
344
+
345
+ #
346
+ # Creates or updates a remediation at management group scope.
347
+ #
348
+ # @param management_group_id [String] Management group ID.
349
+ # @param remediation_name [String] The name of the remediation.
350
+ # @param parameters [Remediation] The remediation parameters.
351
+ # @param [Hash{String => String}] A hash of custom headers that will be added
352
+ # to the HTTP request.
353
+ #
354
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
355
+ #
356
+ def create_or_update_at_management_group_async(management_group_id, remediation_name, parameters, custom_headers:nil)
357
+ management_groups_namespace = 'Microsoft.Management'
358
+ fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
359
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
360
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
361
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
362
+
363
+
364
+ request_headers = {}
365
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
366
+
367
+ # Set Headers
368
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
369
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
370
+
371
+ # Serialize Request
372
+ request_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
373
+ request_content = @client.serialize(request_mapper, parameters)
374
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
375
+
376
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
377
+
378
+ request_url = @base_url || @client.base_url
379
+
380
+ options = {
381
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
382
+ path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
383
+ query_params: {'api-version' => @client.api_version},
384
+ body: request_content,
385
+ headers: request_headers.merge(custom_headers || {}),
386
+ base_url: request_url
387
+ }
388
+ promise = @client.make_request_async(:put, path_template, options)
389
+
390
+ promise = promise.then do |result|
391
+ http_response = result.response
392
+ status_code = http_response.status
393
+ response_content = http_response.body
394
+ unless status_code == 200 || status_code == 201
395
+ error_model = JSON.load(response_content)
396
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
397
+ end
398
+
399
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
400
+ # Deserialize Response
401
+ if status_code == 200
402
+ begin
403
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
404
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
405
+ result.body = @client.deserialize(result_mapper, parsed_response)
406
+ rescue Exception => e
407
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
408
+ end
409
+ end
410
+ # Deserialize Response
411
+ if status_code == 201
412
+ begin
413
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
414
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
415
+ result.body = @client.deserialize(result_mapper, parsed_response)
416
+ rescue Exception => e
417
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
418
+ end
419
+ end
420
+
421
+ result
422
+ end
423
+
424
+ promise.execute
425
+ end
426
+
427
+ #
428
+ # Gets an existing remediation at management group scope.
429
+ #
430
+ # @param management_group_id [String] Management group ID.
431
+ # @param remediation_name [String] The name of the remediation.
432
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
433
+ # will be added to the HTTP request.
434
+ #
435
+ # @return [Remediation] operation results.
436
+ #
437
+ def get_at_management_group(management_group_id, remediation_name, custom_headers:nil)
438
+ response = get_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
439
+ response.body unless response.nil?
440
+ end
441
+
442
+ #
443
+ # Gets an existing remediation at management group scope.
444
+ #
445
+ # @param management_group_id [String] Management group ID.
446
+ # @param remediation_name [String] The name of the remediation.
447
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
448
+ # will be added to the HTTP request.
449
+ #
450
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
451
+ #
452
+ def get_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil)
453
+ get_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
454
+ end
455
+
456
+ #
457
+ # Gets an existing remediation at management group scope.
458
+ #
459
+ # @param management_group_id [String] Management group ID.
460
+ # @param remediation_name [String] The name of the remediation.
461
+ # @param [Hash{String => String}] A hash of custom headers that will be added
462
+ # to the HTTP request.
463
+ #
464
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
465
+ #
466
+ def get_at_management_group_async(management_group_id, remediation_name, custom_headers:nil)
467
+ management_groups_namespace = 'Microsoft.Management'
468
+ fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
469
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
470
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
471
+
472
+
473
+ request_headers = {}
474
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
475
+
476
+ # Set Headers
477
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
478
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
479
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
480
+
481
+ request_url = @base_url || @client.base_url
482
+
483
+ options = {
484
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
485
+ path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
486
+ query_params: {'api-version' => @client.api_version},
487
+ headers: request_headers.merge(custom_headers || {}),
488
+ base_url: request_url
489
+ }
490
+ promise = @client.make_request_async(:get, path_template, options)
491
+
492
+ promise = promise.then do |result|
493
+ http_response = result.response
494
+ status_code = http_response.status
495
+ response_content = http_response.body
496
+ unless status_code == 200
497
+ error_model = JSON.load(response_content)
498
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
499
+ end
500
+
501
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
502
+ # Deserialize Response
503
+ if status_code == 200
504
+ begin
505
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
506
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
507
+ result.body = @client.deserialize(result_mapper, parsed_response)
508
+ rescue Exception => e
509
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
510
+ end
511
+ end
512
+
513
+ result
514
+ end
515
+
516
+ promise.execute
517
+ end
518
+
519
+ #
520
+ # Deletes an existing remediation at management group scope.
521
+ #
522
+ # @param management_group_id [String] Management group ID.
523
+ # @param remediation_name [String] The name of the remediation.
524
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
525
+ # will be added to the HTTP request.
526
+ #
527
+ # @return [Remediation] operation results.
528
+ #
529
+ def delete_at_management_group(management_group_id, remediation_name, custom_headers:nil)
530
+ response = delete_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
531
+ response.body unless response.nil?
532
+ end
533
+
534
+ #
535
+ # Deletes an existing remediation at management group scope.
536
+ #
537
+ # @param management_group_id [String] Management group ID.
538
+ # @param remediation_name [String] The name of the remediation.
539
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
540
+ # will be added to the HTTP request.
541
+ #
542
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
543
+ #
544
+ def delete_at_management_group_with_http_info(management_group_id, remediation_name, custom_headers:nil)
545
+ delete_at_management_group_async(management_group_id, remediation_name, custom_headers:custom_headers).value!
546
+ end
547
+
548
+ #
549
+ # Deletes an existing remediation at management group scope.
550
+ #
551
+ # @param management_group_id [String] Management group ID.
552
+ # @param remediation_name [String] The name of the remediation.
553
+ # @param [Hash{String => String}] A hash of custom headers that will be added
554
+ # to the HTTP request.
555
+ #
556
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
557
+ #
558
+ def delete_at_management_group_async(management_group_id, remediation_name, custom_headers:nil)
559
+ management_groups_namespace = 'Microsoft.Management'
560
+ fail ArgumentError, 'management_group_id is nil' if management_group_id.nil?
561
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
562
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
563
+
564
+
565
+ request_headers = {}
566
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
567
+
568
+ # Set Headers
569
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
570
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
571
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
572
+
573
+ request_url = @base_url || @client.base_url
574
+
575
+ options = {
576
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
577
+ path_params: {'managementGroupsNamespace' => management_groups_namespace,'managementGroupId' => management_group_id,'remediationName' => remediation_name},
578
+ query_params: {'api-version' => @client.api_version},
579
+ headers: request_headers.merge(custom_headers || {}),
580
+ base_url: request_url
581
+ }
582
+ promise = @client.make_request_async(:delete, path_template, options)
583
+
584
+ promise = promise.then do |result|
585
+ http_response = result.response
586
+ status_code = http_response.status
587
+ response_content = http_response.body
588
+ unless status_code == 200 || status_code == 204
589
+ error_model = JSON.load(response_content)
590
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
591
+ end
592
+
593
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
594
+ # Deserialize Response
595
+ if status_code == 200
596
+ begin
597
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
598
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
599
+ result.body = @client.deserialize(result_mapper, parsed_response)
600
+ rescue Exception => e
601
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
602
+ end
603
+ end
604
+
605
+ result
606
+ end
607
+
608
+ promise.execute
609
+ end
610
+
611
+ #
612
+ # Gets all deployments for a remediation at subscription scope.
613
+ #
614
+ # @param remediation_name [String] The name of the remediation.
615
+ # @param query_options [QueryOptions] Additional parameters for the operation
616
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
617
+ # will be added to the HTTP request.
618
+ #
619
+ # @return [Array<RemediationDeployment>] operation results.
620
+ #
621
+ def list_deployments_at_subscription(remediation_name, query_options:nil, custom_headers:nil)
622
+ first_page = list_deployments_at_subscription_as_lazy(remediation_name, query_options:query_options, custom_headers:custom_headers)
623
+ first_page.get_all_items
624
+ end
625
+
626
+ #
627
+ # Gets all deployments for a remediation at subscription scope.
628
+ #
629
+ # @param remediation_name [String] The name of the remediation.
630
+ # @param query_options [QueryOptions] Additional parameters for the operation
631
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
632
+ # will be added to the HTTP request.
633
+ #
634
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
635
+ #
636
+ def list_deployments_at_subscription_with_http_info(remediation_name, query_options:nil, custom_headers:nil)
637
+ list_deployments_at_subscription_async(remediation_name, query_options:query_options, custom_headers:custom_headers).value!
638
+ end
639
+
640
+ #
641
+ # Gets all deployments for a remediation at subscription scope.
642
+ #
643
+ # @param remediation_name [String] The name of the remediation.
644
+ # @param query_options [QueryOptions] Additional parameters for the operation
645
+ # @param [Hash{String => String}] A hash of custom headers that will be added
646
+ # to the HTTP request.
647
+ #
648
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
649
+ #
650
+ def list_deployments_at_subscription_async(remediation_name, query_options:nil, custom_headers:nil)
651
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
652
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
653
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
654
+
655
+ top = nil
656
+ unless query_options.nil?
657
+ top = query_options.Top
658
+ end
659
+
660
+ request_headers = {}
661
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
662
+
663
+ # Set Headers
664
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
665
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
666
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments'
667
+
668
+ request_url = @base_url || @client.base_url
669
+
670
+ options = {
671
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
672
+ path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
673
+ query_params: {'api-version' => @client.api_version,'$top' => top},
674
+ headers: request_headers.merge(custom_headers || {}),
675
+ base_url: request_url
676
+ }
677
+ promise = @client.make_request_async(:post, path_template, options)
678
+
679
+ promise = promise.then do |result|
680
+ http_response = result.response
681
+ status_code = http_response.status
682
+ response_content = http_response.body
683
+ unless status_code == 200
684
+ error_model = JSON.load(response_content)
685
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
686
+ end
687
+
688
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
689
+ # Deserialize Response
690
+ if status_code == 200
691
+ begin
692
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
693
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
694
+ result.body = @client.deserialize(result_mapper, parsed_response)
695
+ rescue Exception => e
696
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
697
+ end
698
+ end
699
+
700
+ result
701
+ end
702
+
703
+ promise.execute
704
+ end
705
+
706
+ #
707
+ # Cancels a remediation at subscription scope.
708
+ #
709
+ # @param remediation_name [String] The name of the remediation.
710
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
711
+ # will be added to the HTTP request.
712
+ #
713
+ # @return [Remediation] operation results.
714
+ #
715
+ def cancel_at_subscription(remediation_name, custom_headers:nil)
716
+ response = cancel_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
717
+ response.body unless response.nil?
718
+ end
719
+
720
+ #
721
+ # Cancels a remediation at subscription scope.
722
+ #
723
+ # @param remediation_name [String] The name of the remediation.
724
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
725
+ # will be added to the HTTP request.
726
+ #
727
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
728
+ #
729
+ def cancel_at_subscription_with_http_info(remediation_name, custom_headers:nil)
730
+ cancel_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
731
+ end
732
+
733
+ #
734
+ # Cancels a remediation at subscription scope.
735
+ #
736
+ # @param remediation_name [String] The name of the remediation.
737
+ # @param [Hash{String => String}] A hash of custom headers that will be added
738
+ # to the HTTP request.
739
+ #
740
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
741
+ #
742
+ def cancel_at_subscription_async(remediation_name, custom_headers:nil)
743
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
744
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
745
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
746
+
747
+
748
+ request_headers = {}
749
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
750
+
751
+ # Set Headers
752
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
753
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
754
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel'
755
+
756
+ request_url = @base_url || @client.base_url
757
+
758
+ options = {
759
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
760
+ path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
761
+ query_params: {'api-version' => @client.api_version},
762
+ headers: request_headers.merge(custom_headers || {}),
763
+ base_url: request_url
764
+ }
765
+ promise = @client.make_request_async(:post, path_template, options)
766
+
767
+ promise = promise.then do |result|
768
+ http_response = result.response
769
+ status_code = http_response.status
770
+ response_content = http_response.body
771
+ unless status_code == 200
772
+ error_model = JSON.load(response_content)
773
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
774
+ end
775
+
776
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
777
+ # Deserialize Response
778
+ if status_code == 200
779
+ begin
780
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
781
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
782
+ result.body = @client.deserialize(result_mapper, parsed_response)
783
+ rescue Exception => e
784
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
785
+ end
786
+ end
787
+
788
+ result
789
+ end
790
+
791
+ promise.execute
792
+ end
793
+
794
+ #
795
+ # Gets all remediations for the subscription.
796
+ #
797
+ # @param query_options [QueryOptions] Additional parameters for the operation
798
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
799
+ # will be added to the HTTP request.
800
+ #
801
+ # @return [Array<Remediation>] operation results.
802
+ #
803
+ def list_for_subscription(query_options:nil, custom_headers:nil)
804
+ first_page = list_for_subscription_as_lazy(query_options:query_options, custom_headers:custom_headers)
805
+ first_page.get_all_items
806
+ end
807
+
808
+ #
809
+ # Gets all remediations for the subscription.
810
+ #
811
+ # @param query_options [QueryOptions] Additional parameters for the operation
812
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
813
+ # will be added to the HTTP request.
814
+ #
815
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
816
+ #
817
+ def list_for_subscription_with_http_info(query_options:nil, custom_headers:nil)
818
+ list_for_subscription_async(query_options:query_options, custom_headers:custom_headers).value!
819
+ end
820
+
821
+ #
822
+ # Gets all remediations for the subscription.
823
+ #
824
+ # @param query_options [QueryOptions] Additional parameters for the operation
825
+ # @param [Hash{String => String}] A hash of custom headers that will be added
826
+ # to the HTTP request.
827
+ #
828
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
829
+ #
830
+ def list_for_subscription_async(query_options:nil, custom_headers:nil)
831
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
832
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
833
+
834
+ top = nil
835
+ filter = nil
836
+ unless query_options.nil?
837
+ top = query_options.Top
838
+ end
839
+ unless query_options.nil?
840
+ filter = query_options.Filter
841
+ end
842
+
843
+ request_headers = {}
844
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
845
+
846
+ # Set Headers
847
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
848
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
849
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations'
850
+
851
+ request_url = @base_url || @client.base_url
852
+
853
+ options = {
854
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
855
+ path_params: {'subscriptionId' => @client.subscription_id},
856
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
857
+ headers: request_headers.merge(custom_headers || {}),
858
+ base_url: request_url
859
+ }
860
+ promise = @client.make_request_async(:get, path_template, options)
861
+
862
+ promise = promise.then do |result|
863
+ http_response = result.response
864
+ status_code = http_response.status
865
+ response_content = http_response.body
866
+ unless status_code == 200
867
+ error_model = JSON.load(response_content)
868
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
869
+ end
870
+
871
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
872
+ # Deserialize Response
873
+ if status_code == 200
874
+ begin
875
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
876
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
877
+ result.body = @client.deserialize(result_mapper, parsed_response)
878
+ rescue Exception => e
879
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
880
+ end
881
+ end
882
+
883
+ result
884
+ end
885
+
886
+ promise.execute
887
+ end
888
+
889
+ #
890
+ # Creates or updates a remediation at subscription scope.
891
+ #
892
+ # @param remediation_name [String] The name of the remediation.
893
+ # @param parameters [Remediation] The remediation parameters.
894
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
895
+ # will be added to the HTTP request.
896
+ #
897
+ # @return [Remediation] operation results.
898
+ #
899
+ def create_or_update_at_subscription(remediation_name, parameters, custom_headers:nil)
900
+ response = create_or_update_at_subscription_async(remediation_name, parameters, custom_headers:custom_headers).value!
901
+ response.body unless response.nil?
902
+ end
903
+
904
+ #
905
+ # Creates or updates a remediation at subscription scope.
906
+ #
907
+ # @param remediation_name [String] The name of the remediation.
908
+ # @param parameters [Remediation] The remediation parameters.
909
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
910
+ # will be added to the HTTP request.
911
+ #
912
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
913
+ #
914
+ def create_or_update_at_subscription_with_http_info(remediation_name, parameters, custom_headers:nil)
915
+ create_or_update_at_subscription_async(remediation_name, parameters, custom_headers:custom_headers).value!
916
+ end
917
+
918
+ #
919
+ # Creates or updates a remediation at subscription scope.
920
+ #
921
+ # @param remediation_name [String] The name of the remediation.
922
+ # @param parameters [Remediation] The remediation parameters.
923
+ # @param [Hash{String => String}] A hash of custom headers that will be added
924
+ # to the HTTP request.
925
+ #
926
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
927
+ #
928
+ def create_or_update_at_subscription_async(remediation_name, parameters, custom_headers:nil)
929
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
930
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
931
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
932
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
933
+
934
+
935
+ request_headers = {}
936
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
937
+
938
+ # Set Headers
939
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
940
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
941
+
942
+ # Serialize Request
943
+ request_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
944
+ request_content = @client.serialize(request_mapper, parameters)
945
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
946
+
947
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
948
+
949
+ request_url = @base_url || @client.base_url
950
+
951
+ options = {
952
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
953
+ path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
954
+ query_params: {'api-version' => @client.api_version},
955
+ body: request_content,
956
+ headers: request_headers.merge(custom_headers || {}),
957
+ base_url: request_url
958
+ }
959
+ promise = @client.make_request_async(:put, path_template, options)
960
+
961
+ promise = promise.then do |result|
962
+ http_response = result.response
963
+ status_code = http_response.status
964
+ response_content = http_response.body
965
+ unless status_code == 200 || status_code == 201
966
+ error_model = JSON.load(response_content)
967
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
968
+ end
969
+
970
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
971
+ # Deserialize Response
972
+ if status_code == 200
973
+ begin
974
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
975
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
976
+ result.body = @client.deserialize(result_mapper, parsed_response)
977
+ rescue Exception => e
978
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
979
+ end
980
+ end
981
+ # Deserialize Response
982
+ if status_code == 201
983
+ begin
984
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
985
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
986
+ result.body = @client.deserialize(result_mapper, parsed_response)
987
+ rescue Exception => e
988
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
989
+ end
990
+ end
991
+
992
+ result
993
+ end
994
+
995
+ promise.execute
996
+ end
997
+
998
+ #
999
+ # Gets an existing remediation at subscription scope.
1000
+ #
1001
+ # @param remediation_name [String] The name of the remediation.
1002
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1003
+ # will be added to the HTTP request.
1004
+ #
1005
+ # @return [Remediation] operation results.
1006
+ #
1007
+ def get_at_subscription(remediation_name, custom_headers:nil)
1008
+ response = get_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
1009
+ response.body unless response.nil?
1010
+ end
1011
+
1012
+ #
1013
+ # Gets an existing remediation at subscription scope.
1014
+ #
1015
+ # @param remediation_name [String] The name of the remediation.
1016
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1017
+ # will be added to the HTTP request.
1018
+ #
1019
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1020
+ #
1021
+ def get_at_subscription_with_http_info(remediation_name, custom_headers:nil)
1022
+ get_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
1023
+ end
1024
+
1025
+ #
1026
+ # Gets an existing remediation at subscription scope.
1027
+ #
1028
+ # @param remediation_name [String] The name of the remediation.
1029
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1030
+ # to the HTTP request.
1031
+ #
1032
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1033
+ #
1034
+ def get_at_subscription_async(remediation_name, custom_headers:nil)
1035
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1036
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1037
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1038
+
1039
+
1040
+ request_headers = {}
1041
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1042
+
1043
+ # Set Headers
1044
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1045
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1046
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
1047
+
1048
+ request_url = @base_url || @client.base_url
1049
+
1050
+ options = {
1051
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1052
+ path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
1053
+ query_params: {'api-version' => @client.api_version},
1054
+ headers: request_headers.merge(custom_headers || {}),
1055
+ base_url: request_url
1056
+ }
1057
+ promise = @client.make_request_async(:get, path_template, options)
1058
+
1059
+ promise = promise.then do |result|
1060
+ http_response = result.response
1061
+ status_code = http_response.status
1062
+ response_content = http_response.body
1063
+ unless status_code == 200
1064
+ error_model = JSON.load(response_content)
1065
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1066
+ end
1067
+
1068
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1069
+ # Deserialize Response
1070
+ if status_code == 200
1071
+ begin
1072
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1073
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1074
+ result.body = @client.deserialize(result_mapper, parsed_response)
1075
+ rescue Exception => e
1076
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1077
+ end
1078
+ end
1079
+
1080
+ result
1081
+ end
1082
+
1083
+ promise.execute
1084
+ end
1085
+
1086
+ #
1087
+ # Deletes an existing remediation at subscription scope.
1088
+ #
1089
+ # @param remediation_name [String] The name of the remediation.
1090
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1091
+ # will be added to the HTTP request.
1092
+ #
1093
+ # @return [Remediation] operation results.
1094
+ #
1095
+ def delete_at_subscription(remediation_name, custom_headers:nil)
1096
+ response = delete_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
1097
+ response.body unless response.nil?
1098
+ end
1099
+
1100
+ #
1101
+ # Deletes an existing remediation at subscription scope.
1102
+ #
1103
+ # @param remediation_name [String] The name of the remediation.
1104
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1105
+ # will be added to the HTTP request.
1106
+ #
1107
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1108
+ #
1109
+ def delete_at_subscription_with_http_info(remediation_name, custom_headers:nil)
1110
+ delete_at_subscription_async(remediation_name, custom_headers:custom_headers).value!
1111
+ end
1112
+
1113
+ #
1114
+ # Deletes an existing remediation at subscription scope.
1115
+ #
1116
+ # @param remediation_name [String] The name of the remediation.
1117
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1118
+ # to the HTTP request.
1119
+ #
1120
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1121
+ #
1122
+ def delete_at_subscription_async(remediation_name, custom_headers:nil)
1123
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1124
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1125
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1126
+
1127
+
1128
+ request_headers = {}
1129
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1130
+
1131
+ # Set Headers
1132
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1133
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1134
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
1135
+
1136
+ request_url = @base_url || @client.base_url
1137
+
1138
+ options = {
1139
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1140
+ path_params: {'subscriptionId' => @client.subscription_id,'remediationName' => remediation_name},
1141
+ query_params: {'api-version' => @client.api_version},
1142
+ headers: request_headers.merge(custom_headers || {}),
1143
+ base_url: request_url
1144
+ }
1145
+ promise = @client.make_request_async(:delete, path_template, options)
1146
+
1147
+ promise = promise.then do |result|
1148
+ http_response = result.response
1149
+ status_code = http_response.status
1150
+ response_content = http_response.body
1151
+ unless status_code == 200 || status_code == 204
1152
+ error_model = JSON.load(response_content)
1153
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1154
+ end
1155
+
1156
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1157
+ # Deserialize Response
1158
+ if status_code == 200
1159
+ begin
1160
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1161
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1162
+ result.body = @client.deserialize(result_mapper, parsed_response)
1163
+ rescue Exception => e
1164
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1165
+ end
1166
+ end
1167
+
1168
+ result
1169
+ end
1170
+
1171
+ promise.execute
1172
+ end
1173
+
1174
+ #
1175
+ # Gets all deployments for a remediation at resource group scope.
1176
+ #
1177
+ # @param resource_group_name [String] Resource group name.
1178
+ # @param remediation_name [String] The name of the remediation.
1179
+ # @param query_options [QueryOptions] Additional parameters for the operation
1180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1181
+ # will be added to the HTTP request.
1182
+ #
1183
+ # @return [Array<RemediationDeployment>] operation results.
1184
+ #
1185
+ def list_deployments_at_resource_group(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
1186
+ first_page = list_deployments_at_resource_group_as_lazy(resource_group_name, remediation_name, query_options:query_options, custom_headers:custom_headers)
1187
+ first_page.get_all_items
1188
+ end
1189
+
1190
+ #
1191
+ # Gets all deployments for a remediation at resource group scope.
1192
+ #
1193
+ # @param resource_group_name [String] Resource group name.
1194
+ # @param remediation_name [String] The name of the remediation.
1195
+ # @param query_options [QueryOptions] Additional parameters for the operation
1196
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1197
+ # will be added to the HTTP request.
1198
+ #
1199
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1200
+ #
1201
+ def list_deployments_at_resource_group_with_http_info(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
1202
+ list_deployments_at_resource_group_async(resource_group_name, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
1203
+ end
1204
+
1205
+ #
1206
+ # Gets all deployments for a remediation at resource group scope.
1207
+ #
1208
+ # @param resource_group_name [String] Resource group name.
1209
+ # @param remediation_name [String] The name of the remediation.
1210
+ # @param query_options [QueryOptions] Additional parameters for the operation
1211
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1212
+ # to the HTTP request.
1213
+ #
1214
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1215
+ #
1216
+ def list_deployments_at_resource_group_async(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
1217
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1218
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1219
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1220
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1221
+
1222
+ top = nil
1223
+ unless query_options.nil?
1224
+ top = query_options.Top
1225
+ end
1226
+
1227
+ request_headers = {}
1228
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1229
+
1230
+ # Set Headers
1231
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1232
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1233
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments'
1234
+
1235
+ request_url = @base_url || @client.base_url
1236
+
1237
+ options = {
1238
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1239
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
1240
+ query_params: {'api-version' => @client.api_version,'$top' => top},
1241
+ headers: request_headers.merge(custom_headers || {}),
1242
+ base_url: request_url
1243
+ }
1244
+ promise = @client.make_request_async(:post, path_template, options)
1245
+
1246
+ promise = promise.then do |result|
1247
+ http_response = result.response
1248
+ status_code = http_response.status
1249
+ response_content = http_response.body
1250
+ unless status_code == 200
1251
+ error_model = JSON.load(response_content)
1252
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1253
+ end
1254
+
1255
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1256
+ # Deserialize Response
1257
+ if status_code == 200
1258
+ begin
1259
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1260
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
1261
+ result.body = @client.deserialize(result_mapper, parsed_response)
1262
+ rescue Exception => e
1263
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1264
+ end
1265
+ end
1266
+
1267
+ result
1268
+ end
1269
+
1270
+ promise.execute
1271
+ end
1272
+
1273
+ #
1274
+ # Cancels a remediation at resource group scope.
1275
+ #
1276
+ # @param resource_group_name [String] Resource group name.
1277
+ # @param remediation_name [String] The name of the remediation.
1278
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1279
+ # will be added to the HTTP request.
1280
+ #
1281
+ # @return [Remediation] operation results.
1282
+ #
1283
+ def cancel_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
1284
+ response = cancel_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
1285
+ response.body unless response.nil?
1286
+ end
1287
+
1288
+ #
1289
+ # Cancels a remediation at resource group scope.
1290
+ #
1291
+ # @param resource_group_name [String] Resource group name.
1292
+ # @param remediation_name [String] The name of the remediation.
1293
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1294
+ # will be added to the HTTP request.
1295
+ #
1296
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1297
+ #
1298
+ def cancel_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil)
1299
+ cancel_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
1300
+ end
1301
+
1302
+ #
1303
+ # Cancels a remediation at resource group scope.
1304
+ #
1305
+ # @param resource_group_name [String] Resource group name.
1306
+ # @param remediation_name [String] The name of the remediation.
1307
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1308
+ # to the HTTP request.
1309
+ #
1310
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1311
+ #
1312
+ def cancel_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil)
1313
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1314
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1315
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1316
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1317
+
1318
+
1319
+ request_headers = {}
1320
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1321
+
1322
+ # Set Headers
1323
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1324
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1325
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel'
1326
+
1327
+ request_url = @base_url || @client.base_url
1328
+
1329
+ options = {
1330
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1331
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
1332
+ query_params: {'api-version' => @client.api_version},
1333
+ headers: request_headers.merge(custom_headers || {}),
1334
+ base_url: request_url
1335
+ }
1336
+ promise = @client.make_request_async(:post, path_template, options)
1337
+
1338
+ promise = promise.then do |result|
1339
+ http_response = result.response
1340
+ status_code = http_response.status
1341
+ response_content = http_response.body
1342
+ unless status_code == 200
1343
+ error_model = JSON.load(response_content)
1344
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1345
+ end
1346
+
1347
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1348
+ # Deserialize Response
1349
+ if status_code == 200
1350
+ begin
1351
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1352
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1353
+ result.body = @client.deserialize(result_mapper, parsed_response)
1354
+ rescue Exception => e
1355
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1356
+ end
1357
+ end
1358
+
1359
+ result
1360
+ end
1361
+
1362
+ promise.execute
1363
+ end
1364
+
1365
+ #
1366
+ # Gets all remediations for the subscription.
1367
+ #
1368
+ # @param resource_group_name [String] Resource group name.
1369
+ # @param query_options [QueryOptions] Additional parameters for the operation
1370
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1371
+ # will be added to the HTTP request.
1372
+ #
1373
+ # @return [Array<Remediation>] operation results.
1374
+ #
1375
+ def list_for_resource_group(resource_group_name, query_options:nil, custom_headers:nil)
1376
+ first_page = list_for_resource_group_as_lazy(resource_group_name, query_options:query_options, custom_headers:custom_headers)
1377
+ first_page.get_all_items
1378
+ end
1379
+
1380
+ #
1381
+ # Gets all remediations for the subscription.
1382
+ #
1383
+ # @param resource_group_name [String] Resource group name.
1384
+ # @param query_options [QueryOptions] Additional parameters for the operation
1385
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1386
+ # will be added to the HTTP request.
1387
+ #
1388
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1389
+ #
1390
+ def list_for_resource_group_with_http_info(resource_group_name, query_options:nil, custom_headers:nil)
1391
+ list_for_resource_group_async(resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
1392
+ end
1393
+
1394
+ #
1395
+ # Gets all remediations for the subscription.
1396
+ #
1397
+ # @param resource_group_name [String] Resource group name.
1398
+ # @param query_options [QueryOptions] Additional parameters for the operation
1399
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1400
+ # to the HTTP request.
1401
+ #
1402
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1403
+ #
1404
+ def list_for_resource_group_async(resource_group_name, query_options:nil, custom_headers:nil)
1405
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1406
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1407
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1408
+
1409
+ top = nil
1410
+ filter = nil
1411
+ unless query_options.nil?
1412
+ top = query_options.Top
1413
+ end
1414
+ unless query_options.nil?
1415
+ filter = query_options.Filter
1416
+ end
1417
+
1418
+ request_headers = {}
1419
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1420
+
1421
+ # Set Headers
1422
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1423
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1424
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations'
1425
+
1426
+ request_url = @base_url || @client.base_url
1427
+
1428
+ options = {
1429
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1430
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
1431
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
1432
+ headers: request_headers.merge(custom_headers || {}),
1433
+ base_url: request_url
1434
+ }
1435
+ promise = @client.make_request_async(:get, path_template, options)
1436
+
1437
+ promise = promise.then do |result|
1438
+ http_response = result.response
1439
+ status_code = http_response.status
1440
+ response_content = http_response.body
1441
+ unless status_code == 200
1442
+ error_model = JSON.load(response_content)
1443
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1444
+ end
1445
+
1446
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1447
+ # Deserialize Response
1448
+ if status_code == 200
1449
+ begin
1450
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1451
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
1452
+ result.body = @client.deserialize(result_mapper, parsed_response)
1453
+ rescue Exception => e
1454
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1455
+ end
1456
+ end
1457
+
1458
+ result
1459
+ end
1460
+
1461
+ promise.execute
1462
+ end
1463
+
1464
+ #
1465
+ # Creates or updates a remediation at resource group scope.
1466
+ #
1467
+ # @param resource_group_name [String] Resource group name.
1468
+ # @param remediation_name [String] The name of the remediation.
1469
+ # @param parameters [Remediation] The remediation parameters.
1470
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1471
+ # will be added to the HTTP request.
1472
+ #
1473
+ # @return [Remediation] operation results.
1474
+ #
1475
+ def create_or_update_at_resource_group(resource_group_name, remediation_name, parameters, custom_headers:nil)
1476
+ response = create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:custom_headers).value!
1477
+ response.body unless response.nil?
1478
+ end
1479
+
1480
+ #
1481
+ # Creates or updates a remediation at resource group scope.
1482
+ #
1483
+ # @param resource_group_name [String] Resource group name.
1484
+ # @param remediation_name [String] The name of the remediation.
1485
+ # @param parameters [Remediation] The remediation parameters.
1486
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1487
+ # will be added to the HTTP request.
1488
+ #
1489
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1490
+ #
1491
+ def create_or_update_at_resource_group_with_http_info(resource_group_name, remediation_name, parameters, custom_headers:nil)
1492
+ create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:custom_headers).value!
1493
+ end
1494
+
1495
+ #
1496
+ # Creates or updates a remediation at resource group scope.
1497
+ #
1498
+ # @param resource_group_name [String] Resource group name.
1499
+ # @param remediation_name [String] The name of the remediation.
1500
+ # @param parameters [Remediation] The remediation parameters.
1501
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1502
+ # to the HTTP request.
1503
+ #
1504
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1505
+ #
1506
+ def create_or_update_at_resource_group_async(resource_group_name, remediation_name, parameters, custom_headers:nil)
1507
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1508
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1509
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1510
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1511
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1512
+
1513
+
1514
+ request_headers = {}
1515
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1516
+
1517
+ # Set Headers
1518
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1519
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1520
+
1521
+ # Serialize Request
1522
+ request_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1523
+ request_content = @client.serialize(request_mapper, parameters)
1524
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1525
+
1526
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
1527
+
1528
+ request_url = @base_url || @client.base_url
1529
+
1530
+ options = {
1531
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1532
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
1533
+ query_params: {'api-version' => @client.api_version},
1534
+ body: request_content,
1535
+ headers: request_headers.merge(custom_headers || {}),
1536
+ base_url: request_url
1537
+ }
1538
+ promise = @client.make_request_async(:put, path_template, options)
1539
+
1540
+ promise = promise.then do |result|
1541
+ http_response = result.response
1542
+ status_code = http_response.status
1543
+ response_content = http_response.body
1544
+ unless status_code == 200 || status_code == 201
1545
+ error_model = JSON.load(response_content)
1546
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1547
+ end
1548
+
1549
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1550
+ # Deserialize Response
1551
+ if status_code == 200
1552
+ begin
1553
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1554
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1555
+ result.body = @client.deserialize(result_mapper, parsed_response)
1556
+ rescue Exception => e
1557
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1558
+ end
1559
+ end
1560
+ # Deserialize Response
1561
+ if status_code == 201
1562
+ begin
1563
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1564
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1565
+ result.body = @client.deserialize(result_mapper, parsed_response)
1566
+ rescue Exception => e
1567
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1568
+ end
1569
+ end
1570
+
1571
+ result
1572
+ end
1573
+
1574
+ promise.execute
1575
+ end
1576
+
1577
+ #
1578
+ # Gets an existing remediation at resource group scope.
1579
+ #
1580
+ # @param resource_group_name [String] Resource group name.
1581
+ # @param remediation_name [String] The name of the remediation.
1582
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1583
+ # will be added to the HTTP request.
1584
+ #
1585
+ # @return [Remediation] operation results.
1586
+ #
1587
+ def get_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
1588
+ response = get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
1589
+ response.body unless response.nil?
1590
+ end
1591
+
1592
+ #
1593
+ # Gets an existing remediation at resource group scope.
1594
+ #
1595
+ # @param resource_group_name [String] Resource group name.
1596
+ # @param remediation_name [String] The name of the remediation.
1597
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1598
+ # will be added to the HTTP request.
1599
+ #
1600
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1601
+ #
1602
+ def get_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil)
1603
+ get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
1604
+ end
1605
+
1606
+ #
1607
+ # Gets an existing remediation at resource group scope.
1608
+ #
1609
+ # @param resource_group_name [String] Resource group name.
1610
+ # @param remediation_name [String] The name of the remediation.
1611
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1612
+ # to the HTTP request.
1613
+ #
1614
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1615
+ #
1616
+ def get_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil)
1617
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1618
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1619
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1620
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1621
+
1622
+
1623
+ request_headers = {}
1624
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1625
+
1626
+ # Set Headers
1627
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1628
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1629
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
1630
+
1631
+ request_url = @base_url || @client.base_url
1632
+
1633
+ options = {
1634
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1635
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
1636
+ query_params: {'api-version' => @client.api_version},
1637
+ headers: request_headers.merge(custom_headers || {}),
1638
+ base_url: request_url
1639
+ }
1640
+ promise = @client.make_request_async(:get, path_template, options)
1641
+
1642
+ promise = promise.then do |result|
1643
+ http_response = result.response
1644
+ status_code = http_response.status
1645
+ response_content = http_response.body
1646
+ unless status_code == 200
1647
+ error_model = JSON.load(response_content)
1648
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1649
+ end
1650
+
1651
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1652
+ # Deserialize Response
1653
+ if status_code == 200
1654
+ begin
1655
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1656
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1657
+ result.body = @client.deserialize(result_mapper, parsed_response)
1658
+ rescue Exception => e
1659
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1660
+ end
1661
+ end
1662
+
1663
+ result
1664
+ end
1665
+
1666
+ promise.execute
1667
+ end
1668
+
1669
+ #
1670
+ # Deletes an existing remediation at resource group scope.
1671
+ #
1672
+ # @param resource_group_name [String] Resource group name.
1673
+ # @param remediation_name [String] The name of the remediation.
1674
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1675
+ # will be added to the HTTP request.
1676
+ #
1677
+ # @return [Remediation] operation results.
1678
+ #
1679
+ def delete_at_resource_group(resource_group_name, remediation_name, custom_headers:nil)
1680
+ response = delete_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
1681
+ response.body unless response.nil?
1682
+ end
1683
+
1684
+ #
1685
+ # Deletes an existing remediation at resource group scope.
1686
+ #
1687
+ # @param resource_group_name [String] Resource group name.
1688
+ # @param remediation_name [String] The name of the remediation.
1689
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1690
+ # will be added to the HTTP request.
1691
+ #
1692
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1693
+ #
1694
+ def delete_at_resource_group_with_http_info(resource_group_name, remediation_name, custom_headers:nil)
1695
+ delete_at_resource_group_async(resource_group_name, remediation_name, custom_headers:custom_headers).value!
1696
+ end
1697
+
1698
+ #
1699
+ # Deletes an existing remediation at resource group scope.
1700
+ #
1701
+ # @param resource_group_name [String] Resource group name.
1702
+ # @param remediation_name [String] The name of the remediation.
1703
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1704
+ # to the HTTP request.
1705
+ #
1706
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1707
+ #
1708
+ def delete_at_resource_group_async(resource_group_name, remediation_name, custom_headers:nil)
1709
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1710
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1711
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1712
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1713
+
1714
+
1715
+ request_headers = {}
1716
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1717
+
1718
+ # Set Headers
1719
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1720
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1721
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
1722
+
1723
+ request_url = @base_url || @client.base_url
1724
+
1725
+ options = {
1726
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1727
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'remediationName' => remediation_name},
1728
+ query_params: {'api-version' => @client.api_version},
1729
+ headers: request_headers.merge(custom_headers || {}),
1730
+ base_url: request_url
1731
+ }
1732
+ promise = @client.make_request_async(:delete, path_template, options)
1733
+
1734
+ promise = promise.then do |result|
1735
+ http_response = result.response
1736
+ status_code = http_response.status
1737
+ response_content = http_response.body
1738
+ unless status_code == 200 || status_code == 204
1739
+ error_model = JSON.load(response_content)
1740
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1741
+ end
1742
+
1743
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1744
+ # Deserialize Response
1745
+ if status_code == 200
1746
+ begin
1747
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1748
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1749
+ result.body = @client.deserialize(result_mapper, parsed_response)
1750
+ rescue Exception => e
1751
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1752
+ end
1753
+ end
1754
+
1755
+ result
1756
+ end
1757
+
1758
+ promise.execute
1759
+ end
1760
+
1761
+ #
1762
+ # Gets all deployments for a remediation at resource scope.
1763
+ #
1764
+ # @param resource_id [String] Resource ID.
1765
+ # @param remediation_name [String] The name of the remediation.
1766
+ # @param query_options [QueryOptions] Additional parameters for the operation
1767
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1768
+ # will be added to the HTTP request.
1769
+ #
1770
+ # @return [Array<RemediationDeployment>] operation results.
1771
+ #
1772
+ def list_deployments_at_resource(resource_id, remediation_name, query_options:nil, custom_headers:nil)
1773
+ first_page = list_deployments_at_resource_as_lazy(resource_id, remediation_name, query_options:query_options, custom_headers:custom_headers)
1774
+ first_page.get_all_items
1775
+ end
1776
+
1777
+ #
1778
+ # Gets all deployments for a remediation at resource scope.
1779
+ #
1780
+ # @param resource_id [String] Resource ID.
1781
+ # @param remediation_name [String] The name of the remediation.
1782
+ # @param query_options [QueryOptions] Additional parameters for the operation
1783
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1784
+ # will be added to the HTTP request.
1785
+ #
1786
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1787
+ #
1788
+ def list_deployments_at_resource_with_http_info(resource_id, remediation_name, query_options:nil, custom_headers:nil)
1789
+ list_deployments_at_resource_async(resource_id, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
1790
+ end
1791
+
1792
+ #
1793
+ # Gets all deployments for a remediation at resource scope.
1794
+ #
1795
+ # @param resource_id [String] Resource ID.
1796
+ # @param remediation_name [String] The name of the remediation.
1797
+ # @param query_options [QueryOptions] Additional parameters for the operation
1798
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1799
+ # to the HTTP request.
1800
+ #
1801
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1802
+ #
1803
+ def list_deployments_at_resource_async(resource_id, remediation_name, query_options:nil, custom_headers:nil)
1804
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
1805
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1806
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1807
+
1808
+ top = nil
1809
+ unless query_options.nil?
1810
+ top = query_options.Top
1811
+ end
1812
+
1813
+ request_headers = {}
1814
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1815
+
1816
+ # Set Headers
1817
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1818
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1819
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/listDeployments'
1820
+
1821
+ request_url = @base_url || @client.base_url
1822
+
1823
+ options = {
1824
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1825
+ path_params: {'remediationName' => remediation_name},
1826
+ skip_encoding_path_params: {'resourceId' => resource_id},
1827
+ query_params: {'api-version' => @client.api_version,'$top' => top},
1828
+ headers: request_headers.merge(custom_headers || {}),
1829
+ base_url: request_url
1830
+ }
1831
+ promise = @client.make_request_async(:post, path_template, options)
1832
+
1833
+ promise = promise.then do |result|
1834
+ http_response = result.response
1835
+ status_code = http_response.status
1836
+ response_content = http_response.body
1837
+ unless status_code == 200
1838
+ error_model = JSON.load(response_content)
1839
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1840
+ end
1841
+
1842
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1843
+ # Deserialize Response
1844
+ if status_code == 200
1845
+ begin
1846
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1847
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
1848
+ result.body = @client.deserialize(result_mapper, parsed_response)
1849
+ rescue Exception => e
1850
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1851
+ end
1852
+ end
1853
+
1854
+ result
1855
+ end
1856
+
1857
+ promise.execute
1858
+ end
1859
+
1860
+ #
1861
+ # Cancel a remediation at resource scope.
1862
+ #
1863
+ # @param resource_id [String] Resource ID.
1864
+ # @param remediation_name [String] The name of the remediation.
1865
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1866
+ # will be added to the HTTP request.
1867
+ #
1868
+ # @return [Remediation] operation results.
1869
+ #
1870
+ def cancel_at_resource(resource_id, remediation_name, custom_headers:nil)
1871
+ response = cancel_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
1872
+ response.body unless response.nil?
1873
+ end
1874
+
1875
+ #
1876
+ # Cancel a remediation at resource scope.
1877
+ #
1878
+ # @param resource_id [String] Resource ID.
1879
+ # @param remediation_name [String] The name of the remediation.
1880
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1881
+ # will be added to the HTTP request.
1882
+ #
1883
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1884
+ #
1885
+ def cancel_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil)
1886
+ cancel_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
1887
+ end
1888
+
1889
+ #
1890
+ # Cancel a remediation at resource scope.
1891
+ #
1892
+ # @param resource_id [String] Resource ID.
1893
+ # @param remediation_name [String] The name of the remediation.
1894
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1895
+ # to the HTTP request.
1896
+ #
1897
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1898
+ #
1899
+ def cancel_at_resource_async(resource_id, remediation_name, custom_headers:nil)
1900
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
1901
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
1902
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1903
+
1904
+
1905
+ request_headers = {}
1906
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1907
+
1908
+ # Set Headers
1909
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1910
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1911
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}/cancel'
1912
+
1913
+ request_url = @base_url || @client.base_url
1914
+
1915
+ options = {
1916
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1917
+ path_params: {'remediationName' => remediation_name},
1918
+ skip_encoding_path_params: {'resourceId' => resource_id},
1919
+ query_params: {'api-version' => @client.api_version},
1920
+ headers: request_headers.merge(custom_headers || {}),
1921
+ base_url: request_url
1922
+ }
1923
+ promise = @client.make_request_async(:post, path_template, options)
1924
+
1925
+ promise = promise.then do |result|
1926
+ http_response = result.response
1927
+ status_code = http_response.status
1928
+ response_content = http_response.body
1929
+ unless status_code == 200
1930
+ error_model = JSON.load(response_content)
1931
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1932
+ end
1933
+
1934
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1935
+ # Deserialize Response
1936
+ if status_code == 200
1937
+ begin
1938
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1939
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
1940
+ result.body = @client.deserialize(result_mapper, parsed_response)
1941
+ rescue Exception => e
1942
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1943
+ end
1944
+ end
1945
+
1946
+ result
1947
+ end
1948
+
1949
+ promise.execute
1950
+ end
1951
+
1952
+ #
1953
+ # Gets all remediations for a resource.
1954
+ #
1955
+ # @param resource_id [String] Resource ID.
1956
+ # @param query_options [QueryOptions] Additional parameters for the operation
1957
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1958
+ # will be added to the HTTP request.
1959
+ #
1960
+ # @return [Array<Remediation>] operation results.
1961
+ #
1962
+ def list_for_resource(resource_id, query_options:nil, custom_headers:nil)
1963
+ first_page = list_for_resource_as_lazy(resource_id, query_options:query_options, custom_headers:custom_headers)
1964
+ first_page.get_all_items
1965
+ end
1966
+
1967
+ #
1968
+ # Gets all remediations for a resource.
1969
+ #
1970
+ # @param resource_id [String] Resource ID.
1971
+ # @param query_options [QueryOptions] Additional parameters for the operation
1972
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1973
+ # will be added to the HTTP request.
1974
+ #
1975
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1976
+ #
1977
+ def list_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
1978
+ list_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
1979
+ end
1980
+
1981
+ #
1982
+ # Gets all remediations for a resource.
1983
+ #
1984
+ # @param resource_id [String] Resource ID.
1985
+ # @param query_options [QueryOptions] Additional parameters for the operation
1986
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1987
+ # to the HTTP request.
1988
+ #
1989
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1990
+ #
1991
+ def list_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
1992
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
1993
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1994
+
1995
+ top = nil
1996
+ filter = nil
1997
+ unless query_options.nil?
1998
+ top = query_options.Top
1999
+ end
2000
+ unless query_options.nil?
2001
+ filter = query_options.Filter
2002
+ end
2003
+
2004
+ request_headers = {}
2005
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2006
+
2007
+ # Set Headers
2008
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2009
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2010
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/remediations'
2011
+
2012
+ request_url = @base_url || @client.base_url
2013
+
2014
+ options = {
2015
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2016
+ skip_encoding_path_params: {'resourceId' => resource_id},
2017
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$filter' => filter},
2018
+ headers: request_headers.merge(custom_headers || {}),
2019
+ base_url: request_url
2020
+ }
2021
+ promise = @client.make_request_async(:get, path_template, options)
2022
+
2023
+ promise = promise.then do |result|
2024
+ http_response = result.response
2025
+ status_code = http_response.status
2026
+ response_content = http_response.body
2027
+ unless status_code == 200
2028
+ error_model = JSON.load(response_content)
2029
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2030
+ end
2031
+
2032
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2033
+ # Deserialize Response
2034
+ if status_code == 200
2035
+ begin
2036
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2037
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
2038
+ result.body = @client.deserialize(result_mapper, parsed_response)
2039
+ rescue Exception => e
2040
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2041
+ end
2042
+ end
2043
+
2044
+ result
2045
+ end
2046
+
2047
+ promise.execute
2048
+ end
2049
+
2050
+ #
2051
+ # Creates or updates a remediation at resource scope.
2052
+ #
2053
+ # @param resource_id [String] Resource ID.
2054
+ # @param remediation_name [String] The name of the remediation.
2055
+ # @param parameters [Remediation] The remediation parameters.
2056
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2057
+ # will be added to the HTTP request.
2058
+ #
2059
+ # @return [Remediation] operation results.
2060
+ #
2061
+ def create_or_update_at_resource(resource_id, remediation_name, parameters, custom_headers:nil)
2062
+ response = create_or_update_at_resource_async(resource_id, remediation_name, parameters, custom_headers:custom_headers).value!
2063
+ response.body unless response.nil?
2064
+ end
2065
+
2066
+ #
2067
+ # Creates or updates a remediation at resource scope.
2068
+ #
2069
+ # @param resource_id [String] Resource ID.
2070
+ # @param remediation_name [String] The name of the remediation.
2071
+ # @param parameters [Remediation] The remediation parameters.
2072
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2073
+ # will be added to the HTTP request.
2074
+ #
2075
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2076
+ #
2077
+ def create_or_update_at_resource_with_http_info(resource_id, remediation_name, parameters, custom_headers:nil)
2078
+ create_or_update_at_resource_async(resource_id, remediation_name, parameters, custom_headers:custom_headers).value!
2079
+ end
2080
+
2081
+ #
2082
+ # Creates or updates a remediation at resource scope.
2083
+ #
2084
+ # @param resource_id [String] Resource ID.
2085
+ # @param remediation_name [String] The name of the remediation.
2086
+ # @param parameters [Remediation] The remediation parameters.
2087
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2088
+ # to the HTTP request.
2089
+ #
2090
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2091
+ #
2092
+ def create_or_update_at_resource_async(resource_id, remediation_name, parameters, custom_headers:nil)
2093
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
2094
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
2095
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2096
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
2097
+
2098
+
2099
+ request_headers = {}
2100
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2101
+
2102
+ # Set Headers
2103
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2104
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2105
+
2106
+ # Serialize Request
2107
+ request_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
2108
+ request_content = @client.serialize(request_mapper, parameters)
2109
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2110
+
2111
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
2112
+
2113
+ request_url = @base_url || @client.base_url
2114
+
2115
+ options = {
2116
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2117
+ path_params: {'remediationName' => remediation_name},
2118
+ skip_encoding_path_params: {'resourceId' => resource_id},
2119
+ query_params: {'api-version' => @client.api_version},
2120
+ body: request_content,
2121
+ headers: request_headers.merge(custom_headers || {}),
2122
+ base_url: request_url
2123
+ }
2124
+ promise = @client.make_request_async(:put, path_template, options)
2125
+
2126
+ promise = promise.then do |result|
2127
+ http_response = result.response
2128
+ status_code = http_response.status
2129
+ response_content = http_response.body
2130
+ unless status_code == 200 || status_code == 201
2131
+ error_model = JSON.load(response_content)
2132
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2133
+ end
2134
+
2135
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2136
+ # Deserialize Response
2137
+ if status_code == 200
2138
+ begin
2139
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2140
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
2141
+ result.body = @client.deserialize(result_mapper, parsed_response)
2142
+ rescue Exception => e
2143
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2144
+ end
2145
+ end
2146
+ # Deserialize Response
2147
+ if status_code == 201
2148
+ begin
2149
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2150
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
2151
+ result.body = @client.deserialize(result_mapper, parsed_response)
2152
+ rescue Exception => e
2153
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2154
+ end
2155
+ end
2156
+
2157
+ result
2158
+ end
2159
+
2160
+ promise.execute
2161
+ end
2162
+
2163
+ #
2164
+ # Gets an existing remediation at resource scope.
2165
+ #
2166
+ # @param resource_id [String] Resource ID.
2167
+ # @param remediation_name [String] The name of the remediation.
2168
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2169
+ # will be added to the HTTP request.
2170
+ #
2171
+ # @return [Remediation] operation results.
2172
+ #
2173
+ def get_at_resource(resource_id, remediation_name, custom_headers:nil)
2174
+ response = get_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
2175
+ response.body unless response.nil?
2176
+ end
2177
+
2178
+ #
2179
+ # Gets an existing remediation at resource scope.
2180
+ #
2181
+ # @param resource_id [String] Resource ID.
2182
+ # @param remediation_name [String] The name of the remediation.
2183
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2184
+ # will be added to the HTTP request.
2185
+ #
2186
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2187
+ #
2188
+ def get_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil)
2189
+ get_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
2190
+ end
2191
+
2192
+ #
2193
+ # Gets an existing remediation at resource scope.
2194
+ #
2195
+ # @param resource_id [String] Resource ID.
2196
+ # @param remediation_name [String] The name of the remediation.
2197
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2198
+ # to the HTTP request.
2199
+ #
2200
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2201
+ #
2202
+ def get_at_resource_async(resource_id, remediation_name, custom_headers:nil)
2203
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
2204
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
2205
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2206
+
2207
+
2208
+ request_headers = {}
2209
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2210
+
2211
+ # Set Headers
2212
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2213
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2214
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
2215
+
2216
+ request_url = @base_url || @client.base_url
2217
+
2218
+ options = {
2219
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2220
+ path_params: {'remediationName' => remediation_name},
2221
+ skip_encoding_path_params: {'resourceId' => resource_id},
2222
+ query_params: {'api-version' => @client.api_version},
2223
+ headers: request_headers.merge(custom_headers || {}),
2224
+ base_url: request_url
2225
+ }
2226
+ promise = @client.make_request_async(:get, path_template, options)
2227
+
2228
+ promise = promise.then do |result|
2229
+ http_response = result.response
2230
+ status_code = http_response.status
2231
+ response_content = http_response.body
2232
+ unless status_code == 200
2233
+ error_model = JSON.load(response_content)
2234
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2235
+ end
2236
+
2237
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2238
+ # Deserialize Response
2239
+ if status_code == 200
2240
+ begin
2241
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2242
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
2243
+ result.body = @client.deserialize(result_mapper, parsed_response)
2244
+ rescue Exception => e
2245
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2246
+ end
2247
+ end
2248
+
2249
+ result
2250
+ end
2251
+
2252
+ promise.execute
2253
+ end
2254
+
2255
+ #
2256
+ # Deletes an existing remediation at individual resource scope.
2257
+ #
2258
+ # @param resource_id [String] Resource ID.
2259
+ # @param remediation_name [String] The name of the remediation.
2260
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2261
+ # will be added to the HTTP request.
2262
+ #
2263
+ # @return [Remediation] operation results.
2264
+ #
2265
+ def delete_at_resource(resource_id, remediation_name, custom_headers:nil)
2266
+ response = delete_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
2267
+ response.body unless response.nil?
2268
+ end
2269
+
2270
+ #
2271
+ # Deletes an existing remediation at individual resource scope.
2272
+ #
2273
+ # @param resource_id [String] Resource ID.
2274
+ # @param remediation_name [String] The name of the remediation.
2275
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2276
+ # will be added to the HTTP request.
2277
+ #
2278
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2279
+ #
2280
+ def delete_at_resource_with_http_info(resource_id, remediation_name, custom_headers:nil)
2281
+ delete_at_resource_async(resource_id, remediation_name, custom_headers:custom_headers).value!
2282
+ end
2283
+
2284
+ #
2285
+ # Deletes an existing remediation at individual resource scope.
2286
+ #
2287
+ # @param resource_id [String] Resource ID.
2288
+ # @param remediation_name [String] The name of the remediation.
2289
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2290
+ # to the HTTP request.
2291
+ #
2292
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2293
+ #
2294
+ def delete_at_resource_async(resource_id, remediation_name, custom_headers:nil)
2295
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
2296
+ fail ArgumentError, 'remediation_name is nil' if remediation_name.nil?
2297
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2298
+
2299
+
2300
+ request_headers = {}
2301
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2302
+
2303
+ # Set Headers
2304
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2305
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2306
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/remediations/{remediationName}'
2307
+
2308
+ request_url = @base_url || @client.base_url
2309
+
2310
+ options = {
2311
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2312
+ path_params: {'remediationName' => remediation_name},
2313
+ skip_encoding_path_params: {'resourceId' => resource_id},
2314
+ query_params: {'api-version' => @client.api_version},
2315
+ headers: request_headers.merge(custom_headers || {}),
2316
+ base_url: request_url
2317
+ }
2318
+ promise = @client.make_request_async(:delete, path_template, options)
2319
+
2320
+ promise = promise.then do |result|
2321
+ http_response = result.response
2322
+ status_code = http_response.status
2323
+ response_content = http_response.body
2324
+ unless status_code == 200 || status_code == 204
2325
+ error_model = JSON.load(response_content)
2326
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2327
+ end
2328
+
2329
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2330
+ # Deserialize Response
2331
+ if status_code == 200
2332
+ begin
2333
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2334
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::Remediation.mapper()
2335
+ result.body = @client.deserialize(result_mapper, parsed_response)
2336
+ rescue Exception => e
2337
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2338
+ end
2339
+ end
2340
+
2341
+ result
2342
+ end
2343
+
2344
+ promise.execute
2345
+ end
2346
+
2347
+ #
2348
+ # Gets all deployments for a remediation at management group scope.
2349
+ #
2350
+ # @param next_page_link [String] The NextLink from the previous successful call
2351
+ # to List operation.
2352
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2353
+ # will be added to the HTTP request.
2354
+ #
2355
+ # @return [RemediationDeploymentsListResult] operation results.
2356
+ #
2357
+ def list_deployments_at_management_group_next(next_page_link, custom_headers:nil)
2358
+ response = list_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
2359
+ response.body unless response.nil?
2360
+ end
2361
+
2362
+ #
2363
+ # Gets all deployments for a remediation at management group scope.
2364
+ #
2365
+ # @param next_page_link [String] The NextLink from the previous successful call
2366
+ # to List operation.
2367
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2368
+ # will be added to the HTTP request.
2369
+ #
2370
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2371
+ #
2372
+ def list_deployments_at_management_group_next_with_http_info(next_page_link, custom_headers:nil)
2373
+ list_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
2374
+ end
2375
+
2376
+ #
2377
+ # Gets all deployments for a remediation at management group scope.
2378
+ #
2379
+ # @param next_page_link [String] The NextLink from the previous successful call
2380
+ # to List operation.
2381
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2382
+ # to the HTTP request.
2383
+ #
2384
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2385
+ #
2386
+ def list_deployments_at_management_group_next_async(next_page_link, custom_headers:nil)
2387
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2388
+
2389
+
2390
+ request_headers = {}
2391
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2392
+
2393
+ # Set Headers
2394
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2395
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2396
+ path_template = '{nextLink}'
2397
+
2398
+ request_url = @base_url || @client.base_url
2399
+
2400
+ options = {
2401
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2402
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2403
+ headers: request_headers.merge(custom_headers || {}),
2404
+ base_url: request_url
2405
+ }
2406
+ promise = @client.make_request_async(:post, path_template, options)
2407
+
2408
+ promise = promise.then do |result|
2409
+ http_response = result.response
2410
+ status_code = http_response.status
2411
+ response_content = http_response.body
2412
+ unless status_code == 200
2413
+ error_model = JSON.load(response_content)
2414
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2415
+ end
2416
+
2417
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2418
+ # Deserialize Response
2419
+ if status_code == 200
2420
+ begin
2421
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2422
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
2423
+ result.body = @client.deserialize(result_mapper, parsed_response)
2424
+ rescue Exception => e
2425
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2426
+ end
2427
+ end
2428
+
2429
+ result
2430
+ end
2431
+
2432
+ promise.execute
2433
+ end
2434
+
2435
+ #
2436
+ # Gets all remediations for the management group.
2437
+ #
2438
+ # @param next_page_link [String] The NextLink from the previous successful call
2439
+ # to List operation.
2440
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2441
+ # will be added to the HTTP request.
2442
+ #
2443
+ # @return [RemediationListResult] operation results.
2444
+ #
2445
+ def list_for_management_group_next(next_page_link, custom_headers:nil)
2446
+ response = list_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
2447
+ response.body unless response.nil?
2448
+ end
2449
+
2450
+ #
2451
+ # Gets all remediations for the management group.
2452
+ #
2453
+ # @param next_page_link [String] The NextLink from the previous successful call
2454
+ # to List operation.
2455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2456
+ # will be added to the HTTP request.
2457
+ #
2458
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2459
+ #
2460
+ def list_for_management_group_next_with_http_info(next_page_link, custom_headers:nil)
2461
+ list_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
2462
+ end
2463
+
2464
+ #
2465
+ # Gets all remediations for the management group.
2466
+ #
2467
+ # @param next_page_link [String] The NextLink from the previous successful call
2468
+ # to List operation.
2469
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2470
+ # to the HTTP request.
2471
+ #
2472
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2473
+ #
2474
+ def list_for_management_group_next_async(next_page_link, custom_headers:nil)
2475
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2476
+
2477
+
2478
+ request_headers = {}
2479
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2480
+
2481
+ # Set Headers
2482
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2483
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2484
+ path_template = '{nextLink}'
2485
+
2486
+ request_url = @base_url || @client.base_url
2487
+
2488
+ options = {
2489
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2490
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2491
+ headers: request_headers.merge(custom_headers || {}),
2492
+ base_url: request_url
2493
+ }
2494
+ promise = @client.make_request_async(:get, path_template, options)
2495
+
2496
+ promise = promise.then do |result|
2497
+ http_response = result.response
2498
+ status_code = http_response.status
2499
+ response_content = http_response.body
2500
+ unless status_code == 200
2501
+ error_model = JSON.load(response_content)
2502
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2503
+ end
2504
+
2505
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2506
+ # Deserialize Response
2507
+ if status_code == 200
2508
+ begin
2509
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2510
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
2511
+ result.body = @client.deserialize(result_mapper, parsed_response)
2512
+ rescue Exception => e
2513
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2514
+ end
2515
+ end
2516
+
2517
+ result
2518
+ end
2519
+
2520
+ promise.execute
2521
+ end
2522
+
2523
+ #
2524
+ # Gets all deployments for a remediation at subscription scope.
2525
+ #
2526
+ # @param next_page_link [String] The NextLink from the previous successful call
2527
+ # to List operation.
2528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2529
+ # will be added to the HTTP request.
2530
+ #
2531
+ # @return [RemediationDeploymentsListResult] operation results.
2532
+ #
2533
+ def list_deployments_at_subscription_next(next_page_link, custom_headers:nil)
2534
+ response = list_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2535
+ response.body unless response.nil?
2536
+ end
2537
+
2538
+ #
2539
+ # Gets all deployments for a remediation at subscription scope.
2540
+ #
2541
+ # @param next_page_link [String] The NextLink from the previous successful call
2542
+ # to List operation.
2543
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2544
+ # will be added to the HTTP request.
2545
+ #
2546
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2547
+ #
2548
+ def list_deployments_at_subscription_next_with_http_info(next_page_link, custom_headers:nil)
2549
+ list_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2550
+ end
2551
+
2552
+ #
2553
+ # Gets all deployments for a remediation at subscription scope.
2554
+ #
2555
+ # @param next_page_link [String] The NextLink from the previous successful call
2556
+ # to List operation.
2557
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2558
+ # to the HTTP request.
2559
+ #
2560
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2561
+ #
2562
+ def list_deployments_at_subscription_next_async(next_page_link, custom_headers:nil)
2563
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2564
+
2565
+
2566
+ request_headers = {}
2567
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2568
+
2569
+ # Set Headers
2570
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2571
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2572
+ path_template = '{nextLink}'
2573
+
2574
+ request_url = @base_url || @client.base_url
2575
+
2576
+ options = {
2577
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2578
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2579
+ headers: request_headers.merge(custom_headers || {}),
2580
+ base_url: request_url
2581
+ }
2582
+ promise = @client.make_request_async(:post, path_template, options)
2583
+
2584
+ promise = promise.then do |result|
2585
+ http_response = result.response
2586
+ status_code = http_response.status
2587
+ response_content = http_response.body
2588
+ unless status_code == 200
2589
+ error_model = JSON.load(response_content)
2590
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2591
+ end
2592
+
2593
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2594
+ # Deserialize Response
2595
+ if status_code == 200
2596
+ begin
2597
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2598
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
2599
+ result.body = @client.deserialize(result_mapper, parsed_response)
2600
+ rescue Exception => e
2601
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2602
+ end
2603
+ end
2604
+
2605
+ result
2606
+ end
2607
+
2608
+ promise.execute
2609
+ end
2610
+
2611
+ #
2612
+ # Gets all remediations for the subscription.
2613
+ #
2614
+ # @param next_page_link [String] The NextLink from the previous successful call
2615
+ # to List operation.
2616
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2617
+ # will be added to the HTTP request.
2618
+ #
2619
+ # @return [RemediationListResult] operation results.
2620
+ #
2621
+ def list_for_subscription_next(next_page_link, custom_headers:nil)
2622
+ response = list_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2623
+ response.body unless response.nil?
2624
+ end
2625
+
2626
+ #
2627
+ # Gets all remediations for the subscription.
2628
+ #
2629
+ # @param next_page_link [String] The NextLink from the previous successful call
2630
+ # to List operation.
2631
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2632
+ # will be added to the HTTP request.
2633
+ #
2634
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2635
+ #
2636
+ def list_for_subscription_next_with_http_info(next_page_link, custom_headers:nil)
2637
+ list_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
2638
+ end
2639
+
2640
+ #
2641
+ # Gets all remediations for the subscription.
2642
+ #
2643
+ # @param next_page_link [String] The NextLink from the previous successful call
2644
+ # to List operation.
2645
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2646
+ # to the HTTP request.
2647
+ #
2648
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2649
+ #
2650
+ def list_for_subscription_next_async(next_page_link, custom_headers:nil)
2651
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2652
+
2653
+
2654
+ request_headers = {}
2655
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2656
+
2657
+ # Set Headers
2658
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2659
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2660
+ path_template = '{nextLink}'
2661
+
2662
+ request_url = @base_url || @client.base_url
2663
+
2664
+ options = {
2665
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2666
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2667
+ headers: request_headers.merge(custom_headers || {}),
2668
+ base_url: request_url
2669
+ }
2670
+ promise = @client.make_request_async(:get, path_template, options)
2671
+
2672
+ promise = promise.then do |result|
2673
+ http_response = result.response
2674
+ status_code = http_response.status
2675
+ response_content = http_response.body
2676
+ unless status_code == 200
2677
+ error_model = JSON.load(response_content)
2678
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2679
+ end
2680
+
2681
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2682
+ # Deserialize Response
2683
+ if status_code == 200
2684
+ begin
2685
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2686
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
2687
+ result.body = @client.deserialize(result_mapper, parsed_response)
2688
+ rescue Exception => e
2689
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2690
+ end
2691
+ end
2692
+
2693
+ result
2694
+ end
2695
+
2696
+ promise.execute
2697
+ end
2698
+
2699
+ #
2700
+ # Gets all deployments for a remediation at resource group scope.
2701
+ #
2702
+ # @param next_page_link [String] The NextLink from the previous successful call
2703
+ # to List operation.
2704
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2705
+ # will be added to the HTTP request.
2706
+ #
2707
+ # @return [RemediationDeploymentsListResult] operation results.
2708
+ #
2709
+ def list_deployments_at_resource_group_next(next_page_link, custom_headers:nil)
2710
+ response = list_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2711
+ response.body unless response.nil?
2712
+ end
2713
+
2714
+ #
2715
+ # Gets all deployments for a remediation at resource group scope.
2716
+ #
2717
+ # @param next_page_link [String] The NextLink from the previous successful call
2718
+ # to List operation.
2719
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2720
+ # will be added to the HTTP request.
2721
+ #
2722
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2723
+ #
2724
+ def list_deployments_at_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
2725
+ list_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2726
+ end
2727
+
2728
+ #
2729
+ # Gets all deployments for a remediation at resource group scope.
2730
+ #
2731
+ # @param next_page_link [String] The NextLink from the previous successful call
2732
+ # to List operation.
2733
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2734
+ # to the HTTP request.
2735
+ #
2736
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2737
+ #
2738
+ def list_deployments_at_resource_group_next_async(next_page_link, custom_headers:nil)
2739
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2740
+
2741
+
2742
+ request_headers = {}
2743
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2744
+
2745
+ # Set Headers
2746
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2747
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2748
+ path_template = '{nextLink}'
2749
+
2750
+ request_url = @base_url || @client.base_url
2751
+
2752
+ options = {
2753
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2754
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2755
+ headers: request_headers.merge(custom_headers || {}),
2756
+ base_url: request_url
2757
+ }
2758
+ promise = @client.make_request_async(:post, path_template, options)
2759
+
2760
+ promise = promise.then do |result|
2761
+ http_response = result.response
2762
+ status_code = http_response.status
2763
+ response_content = http_response.body
2764
+ unless status_code == 200
2765
+ error_model = JSON.load(response_content)
2766
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2767
+ end
2768
+
2769
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2770
+ # Deserialize Response
2771
+ if status_code == 200
2772
+ begin
2773
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2774
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
2775
+ result.body = @client.deserialize(result_mapper, parsed_response)
2776
+ rescue Exception => e
2777
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2778
+ end
2779
+ end
2780
+
2781
+ result
2782
+ end
2783
+
2784
+ promise.execute
2785
+ end
2786
+
2787
+ #
2788
+ # Gets all remediations for the subscription.
2789
+ #
2790
+ # @param next_page_link [String] The NextLink from the previous successful call
2791
+ # to List operation.
2792
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2793
+ # will be added to the HTTP request.
2794
+ #
2795
+ # @return [RemediationListResult] operation results.
2796
+ #
2797
+ def list_for_resource_group_next(next_page_link, custom_headers:nil)
2798
+ response = list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2799
+ response.body unless response.nil?
2800
+ end
2801
+
2802
+ #
2803
+ # Gets all remediations for the subscription.
2804
+ #
2805
+ # @param next_page_link [String] The NextLink from the previous successful call
2806
+ # to List operation.
2807
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2808
+ # will be added to the HTTP request.
2809
+ #
2810
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2811
+ #
2812
+ def list_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
2813
+ list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2814
+ end
2815
+
2816
+ #
2817
+ # Gets all remediations for the subscription.
2818
+ #
2819
+ # @param next_page_link [String] The NextLink from the previous successful call
2820
+ # to List operation.
2821
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2822
+ # to the HTTP request.
2823
+ #
2824
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2825
+ #
2826
+ def list_for_resource_group_next_async(next_page_link, custom_headers:nil)
2827
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2828
+
2829
+
2830
+ request_headers = {}
2831
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2832
+
2833
+ # Set Headers
2834
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2835
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2836
+ path_template = '{nextLink}'
2837
+
2838
+ request_url = @base_url || @client.base_url
2839
+
2840
+ options = {
2841
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2842
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2843
+ headers: request_headers.merge(custom_headers || {}),
2844
+ base_url: request_url
2845
+ }
2846
+ promise = @client.make_request_async(:get, path_template, options)
2847
+
2848
+ promise = promise.then do |result|
2849
+ http_response = result.response
2850
+ status_code = http_response.status
2851
+ response_content = http_response.body
2852
+ unless status_code == 200
2853
+ error_model = JSON.load(response_content)
2854
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2855
+ end
2856
+
2857
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2858
+ # Deserialize Response
2859
+ if status_code == 200
2860
+ begin
2861
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2862
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
2863
+ result.body = @client.deserialize(result_mapper, parsed_response)
2864
+ rescue Exception => e
2865
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2866
+ end
2867
+ end
2868
+
2869
+ result
2870
+ end
2871
+
2872
+ promise.execute
2873
+ end
2874
+
2875
+ #
2876
+ # Gets all deployments for a remediation at resource scope.
2877
+ #
2878
+ # @param next_page_link [String] The NextLink from the previous successful call
2879
+ # to List operation.
2880
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2881
+ # will be added to the HTTP request.
2882
+ #
2883
+ # @return [RemediationDeploymentsListResult] operation results.
2884
+ #
2885
+ def list_deployments_at_resource_next(next_page_link, custom_headers:nil)
2886
+ response = list_deployments_at_resource_next_async(next_page_link, custom_headers:custom_headers).value!
2887
+ response.body unless response.nil?
2888
+ end
2889
+
2890
+ #
2891
+ # Gets all deployments for a remediation at resource scope.
2892
+ #
2893
+ # @param next_page_link [String] The NextLink from the previous successful call
2894
+ # to List operation.
2895
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2896
+ # will be added to the HTTP request.
2897
+ #
2898
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2899
+ #
2900
+ def list_deployments_at_resource_next_with_http_info(next_page_link, custom_headers:nil)
2901
+ list_deployments_at_resource_next_async(next_page_link, custom_headers:custom_headers).value!
2902
+ end
2903
+
2904
+ #
2905
+ # Gets all deployments for a remediation at resource scope.
2906
+ #
2907
+ # @param next_page_link [String] The NextLink from the previous successful call
2908
+ # to List operation.
2909
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2910
+ # to the HTTP request.
2911
+ #
2912
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2913
+ #
2914
+ def list_deployments_at_resource_next_async(next_page_link, custom_headers:nil)
2915
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2916
+
2917
+
2918
+ request_headers = {}
2919
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2920
+
2921
+ # Set Headers
2922
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2923
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2924
+ path_template = '{nextLink}'
2925
+
2926
+ request_url = @base_url || @client.base_url
2927
+
2928
+ options = {
2929
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2930
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2931
+ headers: request_headers.merge(custom_headers || {}),
2932
+ base_url: request_url
2933
+ }
2934
+ promise = @client.make_request_async(:post, path_template, options)
2935
+
2936
+ promise = promise.then do |result|
2937
+ http_response = result.response
2938
+ status_code = http_response.status
2939
+ response_content = http_response.body
2940
+ unless status_code == 200
2941
+ error_model = JSON.load(response_content)
2942
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2943
+ end
2944
+
2945
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2946
+ # Deserialize Response
2947
+ if status_code == 200
2948
+ begin
2949
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2950
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationDeploymentsListResult.mapper()
2951
+ result.body = @client.deserialize(result_mapper, parsed_response)
2952
+ rescue Exception => e
2953
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2954
+ end
2955
+ end
2956
+
2957
+ result
2958
+ end
2959
+
2960
+ promise.execute
2961
+ end
2962
+
2963
+ #
2964
+ # Gets all remediations for a resource.
2965
+ #
2966
+ # @param next_page_link [String] The NextLink from the previous successful call
2967
+ # to List operation.
2968
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2969
+ # will be added to the HTTP request.
2970
+ #
2971
+ # @return [RemediationListResult] operation results.
2972
+ #
2973
+ def list_for_resource_next(next_page_link, custom_headers:nil)
2974
+ response = list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
2975
+ response.body unless response.nil?
2976
+ end
2977
+
2978
+ #
2979
+ # Gets all remediations for a resource.
2980
+ #
2981
+ # @param next_page_link [String] The NextLink from the previous successful call
2982
+ # to List operation.
2983
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2984
+ # will be added to the HTTP request.
2985
+ #
2986
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2987
+ #
2988
+ def list_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
2989
+ list_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
2990
+ end
2991
+
2992
+ #
2993
+ # Gets all remediations for a resource.
2994
+ #
2995
+ # @param next_page_link [String] The NextLink from the previous successful call
2996
+ # to List operation.
2997
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2998
+ # to the HTTP request.
2999
+ #
3000
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3001
+ #
3002
+ def list_for_resource_next_async(next_page_link, custom_headers:nil)
3003
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
3004
+
3005
+
3006
+ request_headers = {}
3007
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3008
+
3009
+ # Set Headers
3010
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3011
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3012
+ path_template = '{nextLink}'
3013
+
3014
+ request_url = @base_url || @client.base_url
3015
+
3016
+ options = {
3017
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3018
+ skip_encoding_path_params: {'nextLink' => next_page_link},
3019
+ headers: request_headers.merge(custom_headers || {}),
3020
+ base_url: request_url
3021
+ }
3022
+ promise = @client.make_request_async(:get, path_template, options)
3023
+
3024
+ promise = promise.then do |result|
3025
+ http_response = result.response
3026
+ status_code = http_response.status
3027
+ response_content = http_response.body
3028
+ unless status_code == 200
3029
+ error_model = JSON.load(response_content)
3030
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3031
+ end
3032
+
3033
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3034
+ # Deserialize Response
3035
+ if status_code == 200
3036
+ begin
3037
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3038
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_07_01_preview::Models::RemediationListResult.mapper()
3039
+ result.body = @client.deserialize(result_mapper, parsed_response)
3040
+ rescue Exception => e
3041
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3042
+ end
3043
+ end
3044
+
3045
+ result
3046
+ end
3047
+
3048
+ promise.execute
3049
+ end
3050
+
3051
+ #
3052
+ # Gets all deployments for a remediation at management group scope.
3053
+ #
3054
+ # @param management_group_id [String] Management group ID.
3055
+ # @param remediation_name [String] The name of the remediation.
3056
+ # @param query_options [QueryOptions] Additional parameters for the operation
3057
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3058
+ # will be added to the HTTP request.
3059
+ #
3060
+ # @return [RemediationDeploymentsListResult] which provide lazy access to pages
3061
+ # of the response.
3062
+ #
3063
+ def list_deployments_at_management_group_as_lazy(management_group_id, remediation_name, query_options:nil, custom_headers:nil)
3064
+ response = list_deployments_at_management_group_async(management_group_id, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
3065
+ unless response.nil?
3066
+ page = response.body
3067
+ page.next_method = Proc.new do |next_page_link|
3068
+ list_deployments_at_management_group_next_async(next_page_link, custom_headers:custom_headers)
3069
+ end
3070
+ page
3071
+ end
3072
+ end
3073
+
3074
+ #
3075
+ # Gets all remediations for the management group.
3076
+ #
3077
+ # @param management_group_id [String] Management group ID.
3078
+ # @param query_options [QueryOptions] Additional parameters for the operation
3079
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3080
+ # will be added to the HTTP request.
3081
+ #
3082
+ # @return [RemediationListResult] which provide lazy access to pages of the
3083
+ # response.
3084
+ #
3085
+ def list_for_management_group_as_lazy(management_group_id, query_options:nil, custom_headers:nil)
3086
+ response = list_for_management_group_async(management_group_id, query_options:query_options, custom_headers:custom_headers).value!
3087
+ unless response.nil?
3088
+ page = response.body
3089
+ page.next_method = Proc.new do |next_page_link|
3090
+ list_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
3091
+ end
3092
+ page
3093
+ end
3094
+ end
3095
+
3096
+ #
3097
+ # Gets all deployments for a remediation at subscription scope.
3098
+ #
3099
+ # @param remediation_name [String] The name of the remediation.
3100
+ # @param query_options [QueryOptions] Additional parameters for the operation
3101
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3102
+ # will be added to the HTTP request.
3103
+ #
3104
+ # @return [RemediationDeploymentsListResult] which provide lazy access to pages
3105
+ # of the response.
3106
+ #
3107
+ def list_deployments_at_subscription_as_lazy(remediation_name, query_options:nil, custom_headers:nil)
3108
+ response = list_deployments_at_subscription_async(remediation_name, query_options:query_options, custom_headers:custom_headers).value!
3109
+ unless response.nil?
3110
+ page = response.body
3111
+ page.next_method = Proc.new do |next_page_link|
3112
+ list_deployments_at_subscription_next_async(next_page_link, custom_headers:custom_headers)
3113
+ end
3114
+ page
3115
+ end
3116
+ end
3117
+
3118
+ #
3119
+ # Gets all remediations for the subscription.
3120
+ #
3121
+ # @param query_options [QueryOptions] Additional parameters for the operation
3122
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3123
+ # will be added to the HTTP request.
3124
+ #
3125
+ # @return [RemediationListResult] which provide lazy access to pages of the
3126
+ # response.
3127
+ #
3128
+ def list_for_subscription_as_lazy(query_options:nil, custom_headers:nil)
3129
+ response = list_for_subscription_async(query_options:query_options, custom_headers:custom_headers).value!
3130
+ unless response.nil?
3131
+ page = response.body
3132
+ page.next_method = Proc.new do |next_page_link|
3133
+ list_for_subscription_next_async(next_page_link, custom_headers:custom_headers)
3134
+ end
3135
+ page
3136
+ end
3137
+ end
3138
+
3139
+ #
3140
+ # Gets all deployments for a remediation at resource group scope.
3141
+ #
3142
+ # @param resource_group_name [String] Resource group name.
3143
+ # @param remediation_name [String] The name of the remediation.
3144
+ # @param query_options [QueryOptions] Additional parameters for the operation
3145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3146
+ # will be added to the HTTP request.
3147
+ #
3148
+ # @return [RemediationDeploymentsListResult] which provide lazy access to pages
3149
+ # of the response.
3150
+ #
3151
+ def list_deployments_at_resource_group_as_lazy(resource_group_name, remediation_name, query_options:nil, custom_headers:nil)
3152
+ response = list_deployments_at_resource_group_async(resource_group_name, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
3153
+ unless response.nil?
3154
+ page = response.body
3155
+ page.next_method = Proc.new do |next_page_link|
3156
+ list_deployments_at_resource_group_next_async(next_page_link, custom_headers:custom_headers)
3157
+ end
3158
+ page
3159
+ end
3160
+ end
3161
+
3162
+ #
3163
+ # Gets all remediations for the subscription.
3164
+ #
3165
+ # @param resource_group_name [String] Resource group name.
3166
+ # @param query_options [QueryOptions] Additional parameters for the operation
3167
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3168
+ # will be added to the HTTP request.
3169
+ #
3170
+ # @return [RemediationListResult] which provide lazy access to pages of the
3171
+ # response.
3172
+ #
3173
+ def list_for_resource_group_as_lazy(resource_group_name, query_options:nil, custom_headers:nil)
3174
+ response = list_for_resource_group_async(resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
3175
+ unless response.nil?
3176
+ page = response.body
3177
+ page.next_method = Proc.new do |next_page_link|
3178
+ list_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
3179
+ end
3180
+ page
3181
+ end
3182
+ end
3183
+
3184
+ #
3185
+ # Gets all deployments for a remediation at resource scope.
3186
+ #
3187
+ # @param resource_id [String] Resource ID.
3188
+ # @param remediation_name [String] The name of the remediation.
3189
+ # @param query_options [QueryOptions] Additional parameters for the operation
3190
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3191
+ # will be added to the HTTP request.
3192
+ #
3193
+ # @return [RemediationDeploymentsListResult] which provide lazy access to pages
3194
+ # of the response.
3195
+ #
3196
+ def list_deployments_at_resource_as_lazy(resource_id, remediation_name, query_options:nil, custom_headers:nil)
3197
+ response = list_deployments_at_resource_async(resource_id, remediation_name, query_options:query_options, custom_headers:custom_headers).value!
3198
+ unless response.nil?
3199
+ page = response.body
3200
+ page.next_method = Proc.new do |next_page_link|
3201
+ list_deployments_at_resource_next_async(next_page_link, custom_headers:custom_headers)
3202
+ end
3203
+ page
3204
+ end
3205
+ end
3206
+
3207
+ #
3208
+ # Gets all remediations for a resource.
3209
+ #
3210
+ # @param resource_id [String] Resource ID.
3211
+ # @param query_options [QueryOptions] Additional parameters for the operation
3212
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3213
+ # will be added to the HTTP request.
3214
+ #
3215
+ # @return [RemediationListResult] which provide lazy access to pages of the
3216
+ # response.
3217
+ #
3218
+ def list_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil)
3219
+ response = list_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
3220
+ unless response.nil?
3221
+ page = response.body
3222
+ page.next_method = Proc.new do |next_page_link|
3223
+ list_for_resource_next_async(next_page_link, custom_headers:custom_headers)
3224
+ end
3225
+ page
3226
+ end
3227
+ end
3228
+
3229
+ end
3230
+ end