azure_mgmt_policy_insights 0.17.3 → 0.17.8

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