azure_mgmt_policy_insights 0.17.7 → 0.17.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  3. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  4. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  5. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  6. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +43 -0
  7. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +11 -0
  8. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  9. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_states.rb +998 -32
  10. data/lib/2019-07-01/generated/azure_mgmt_policy_insights.rb +39 -0
  11. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/error_definition.rb +115 -0
  12. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/error_response.rb +47 -0
  13. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/query_options.rb +54 -0
  14. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/remediation.rb +172 -0
  15. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/remediation_deployment.rb +124 -0
  16. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/remediation_deployment_summary.rb +75 -0
  17. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/remediation_deployments_list_result.rb +101 -0
  18. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/remediation_filters.rb +55 -0
  19. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/remediation_list_result.rb +100 -0
  20. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/resource_discovery_mode.rb +16 -0
  21. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/models/typed_error_info.rb +59 -0
  22. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  23. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/policy_insights_client.rb +131 -0
  24. data/lib/2019-07-01/generated/azure_mgmt_policy_insights/remediations.rb +3294 -0
  25. data/lib/2019-10-01/generated/azure_mgmt_policy_insights.rb +18 -13
  26. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/component_event_details.rb +132 -0
  27. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/component_state_details.rb +109 -0
  28. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/expression_evaluation_details.rb +12 -0
  29. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_event.rb +416 -0
  30. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +125 -0
  31. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_state.rb +21 -0
  32. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +43 -0
  33. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/query_options.rb +12 -1
  34. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_events.rb +1961 -0
  35. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_insights_client.rb +5 -1
  36. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb +998 -32
  37. data/lib/azure_mgmt_policy_insights.rb +4 -3
  38. data/lib/profiles/latest/modules/policyinsights_profile_module.rb +23 -11
  39. data/lib/version.rb +1 -1
  40. metadata +23 -3
@@ -0,0 +1,125 @@
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
+ module Models
8
+ #
9
+ # Query results.
10
+ #
11
+ class PolicyEventsQueryResults
12
+
13
+ include MsRestAzure
14
+
15
+ include MsRest::JSONable
16
+ # @return [String] OData context string; used by OData clients to resolve
17
+ # type information based on metadata.
18
+ attr_accessor :odatacontext
19
+
20
+ # @return [Integer] OData entity count; represents the number of policy
21
+ # event records returned.
22
+ attr_accessor :odatacount
23
+
24
+ # @return [String] Odata next link; URL to get the next set of results.
25
+ attr_accessor :odatanext_link
26
+
27
+ # @return [Array<PolicyEvent>] Query results.
28
+ attr_accessor :value
29
+
30
+ # return [Proc] with next page method call.
31
+ attr_accessor :next_method
32
+
33
+ #
34
+ # Gets the rest of the items for the request, enabling auto-pagination.
35
+ #
36
+ # @return [Array<PolicyEvent>] operation results.
37
+ #
38
+ def get_all_items
39
+ items = @value
40
+ page = self
41
+ while page.odatanext_link != nil && !page.odatanext_link.strip.empty? do
42
+ page = page.get_next_page
43
+ items.concat(page.value)
44
+ end
45
+ items
46
+ end
47
+
48
+ #
49
+ # Gets the next page of results.
50
+ #
51
+ # @return [PolicyEventsQueryResults] with next page content.
52
+ #
53
+ def get_next_page
54
+ response = @next_method.call(@odatanext_link).value! unless @next_method.nil?
55
+ unless response.nil?
56
+ @odatanext_link = response.body.odatanext_link
57
+ @value = response.body.value
58
+ self
59
+ end
60
+ end
61
+
62
+ #
63
+ # Mapper for PolicyEventsQueryResults class as Ruby Hash.
64
+ # This will be used for serialization/deserialization.
65
+ #
66
+ def self.mapper()
67
+ {
68
+ client_side_validation: true,
69
+ required: false,
70
+ serialized_name: 'PolicyEventsQueryResults',
71
+ type: {
72
+ name: 'Composite',
73
+ class_name: 'PolicyEventsQueryResults',
74
+ model_properties: {
75
+ odatacontext: {
76
+ client_side_validation: true,
77
+ required: false,
78
+ serialized_name: '@odata\\.context',
79
+ type: {
80
+ name: 'String'
81
+ }
82
+ },
83
+ odatacount: {
84
+ client_side_validation: true,
85
+ required: false,
86
+ serialized_name: '@odata\\.count',
87
+ constraints: {
88
+ InclusiveMinimum: 0
89
+ },
90
+ type: {
91
+ name: 'Number'
92
+ }
93
+ },
94
+ odatanext_link: {
95
+ client_side_validation: true,
96
+ required: false,
97
+ serialized_name: '@odata\\.nextLink',
98
+ type: {
99
+ name: 'String'
100
+ }
101
+ },
102
+ value: {
103
+ client_side_validation: true,
104
+ required: false,
105
+ serialized_name: 'value',
106
+ type: {
107
+ name: 'Sequence',
108
+ element: {
109
+ client_side_validation: true,
110
+ required: false,
111
+ serialized_name: 'PolicyEventElementType',
112
+ type: {
113
+ name: 'Composite',
114
+ class_name: 'PolicyEvent'
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }
121
+ }
122
+ end
123
+ end
124
+ end
125
+ end
@@ -117,6 +117,10 @@ module Azure::PolicyInsights::Mgmt::V2019_10_01
117
117
  # @return [Array<String>] Policy definition group names.
118
118
  attr_accessor :policy_definition_group_names
119
119
 
120
+ # @return [Array<ComponentStateDetails>] Components state compliance
121
+ # records populated only when URL contains $expand=components clause.
122
+ attr_accessor :components
123
+
120
124
  # @return [String] Evaluated policy definition version.
121
125
  attr_accessor :policy_definition_version
122
126
 
@@ -404,6 +408,23 @@ module Azure::PolicyInsights::Mgmt::V2019_10_01
404
408
  }
405
409
  }
406
410
  },
411
+ components: {
412
+ client_side_validation: true,
413
+ required: false,
414
+ serialized_name: 'components',
415
+ type: {
416
+ name: 'Sequence',
417
+ element: {
418
+ client_side_validation: true,
419
+ required: false,
420
+ serialized_name: 'ComponentStateDetailsElementType',
421
+ type: {
422
+ name: 'Composite',
423
+ class_name: 'ComponentStateDetails'
424
+ }
425
+ }
426
+ }
427
+ },
407
428
  policy_definition_version: {
408
429
  client_side_validation: true,
409
430
  required: false,
@@ -12,6 +12,7 @@ module Azure::PolicyInsights::Mgmt::V2019_10_01
12
12
 
13
13
  include MsRestAzure
14
14
 
15
+ include MsRest::JSONable
15
16
  # @return [String] OData context string; used by OData clients to resolve
16
17
  # type information based on metadata.
17
18
  attr_accessor :odatacontext
@@ -20,9 +21,43 @@ module Azure::PolicyInsights::Mgmt::V2019_10_01
20
21
  # state records returned.
21
22
  attr_accessor :odatacount
22
23
 
24
+ # @return [String] Odata next link; URL to get the next set of results.
25
+ attr_accessor :odatanext_link
26
+
23
27
  # @return [Array<PolicyState>] Query results.
24
28
  attr_accessor :value
25
29
 
30
+ # return [Proc] with next page method call.
31
+ attr_accessor :next_method
32
+
33
+ #
34
+ # Gets the rest of the items for the request, enabling auto-pagination.
35
+ #
36
+ # @return [Array<PolicyState>] operation results.
37
+ #
38
+ def get_all_items
39
+ items = @value
40
+ page = self
41
+ while page.odatanext_link != nil && !page.odatanext_link.strip.empty? do
42
+ page = page.get_next_page
43
+ items.concat(page.value)
44
+ end
45
+ items
46
+ end
47
+
48
+ #
49
+ # Gets the next page of results.
50
+ #
51
+ # @return [PolicyStatesQueryResults] with next page content.
52
+ #
53
+ def get_next_page
54
+ response = @next_method.call(@odatanext_link).value! unless @next_method.nil?
55
+ unless response.nil?
56
+ @odatanext_link = response.body.odatanext_link
57
+ @value = response.body.value
58
+ self
59
+ end
60
+ end
26
61
 
27
62
  #
28
63
  # Mapper for PolicyStatesQueryResults class as Ruby Hash.
@@ -56,6 +91,14 @@ module Azure::PolicyInsights::Mgmt::V2019_10_01
56
91
  name: 'Number'
57
92
  }
58
93
  },
94
+ odatanext_link: {
95
+ client_side_validation: true,
96
+ required: false,
97
+ serialized_name: '@odata\\.nextLink',
98
+ type: {
99
+ name: 'String'
100
+ }
101
+ },
59
102
  value: {
60
103
  client_side_validation: true,
61
104
  required: false,
@@ -41,8 +41,12 @@ module Azure::PolicyInsights::Mgmt::V2019_10_01
41
41
  # @return [String] OData apply expression for aggregations.
42
42
  attr_accessor :apply
43
43
 
44
+ # @return [String] Skiptoken is only provided if a previous response
45
+ # returned a partial result as a part of nextLink element.
46
+ attr_accessor :skip_token
47
+
44
48
  # @return [String] The $expand query parameter. For example, to expand
45
- # policyEvaluationDetails, use $expand=policyEvaluationDetails
49
+ # components use $expand=components
46
50
  attr_accessor :expand
47
51
 
48
52
 
@@ -107,6 +111,13 @@ module Azure::PolicyInsights::Mgmt::V2019_10_01
107
111
  name: 'String'
108
112
  }
109
113
  },
114
+ skip_token: {
115
+ client_side_validation: true,
116
+ required: false,
117
+ type: {
118
+ name: 'String'
119
+ }
120
+ },
110
121
  expand: {
111
122
  client_side_validation: true,
112
123
  required: false,
@@ -0,0 +1,1961 @@
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
+ # PolicyEvents
9
+ #
10
+ class PolicyEvents
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PolicyEvents 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 events for the resources under the management group.
26
+ #
27
+ # @param management_group_name [String] Management group name.
28
+ # @param query_options [QueryOptions] Additional parameters for the operation
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<PolicyEvent>] operation results.
33
+ #
34
+ def list_query_results_for_management_group(management_group_name, query_options:nil, custom_headers:nil)
35
+ first_page = list_query_results_for_management_group_as_lazy(management_group_name, query_options:query_options, custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Queries policy events for the resources under the management group.
41
+ #
42
+ # @param management_group_name [String] Management group name.
43
+ # @param query_options [QueryOptions] Additional parameters for the operation
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_query_results_for_management_group_with_http_info(management_group_name, query_options:nil, custom_headers:nil)
50
+ list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Queries policy events for the resources under the management group.
55
+ #
56
+ # @param management_group_name [String] Management group name.
57
+ # @param query_options [QueryOptions] Additional parameters for the operation
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_query_results_for_management_group_async(management_group_name, query_options:nil, custom_headers:nil)
64
+ policy_events_resource = 'default'
65
+ management_groups_namespace = 'Microsoft.Management'
66
+ fail ArgumentError, 'management_group_name is nil' if management_group_name.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+
69
+ top = nil
70
+ order_by = nil
71
+ select = nil
72
+ from = nil
73
+ to = nil
74
+ filter = nil
75
+ apply = nil
76
+ skip_token = nil
77
+ unless query_options.nil?
78
+ top = query_options.Top
79
+ end
80
+ unless query_options.nil?
81
+ order_by = query_options.OrderBy
82
+ end
83
+ unless query_options.nil?
84
+ select = query_options.Select
85
+ end
86
+ unless query_options.nil?
87
+ from = query_options.From
88
+ end
89
+ unless query_options.nil?
90
+ to = query_options.To
91
+ end
92
+ unless query_options.nil?
93
+ filter = query_options.Filter
94
+ end
95
+ unless query_options.nil?
96
+ apply = query_options.Apply
97
+ end
98
+ unless query_options.nil?
99
+ skip_token = query_options.SkipToken
100
+ end
101
+
102
+ request_headers = {}
103
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
104
+
105
+ # Set Headers
106
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
107
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
108
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
109
+
110
+ request_url = @base_url || @client.base_url
111
+
112
+ options = {
113
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
114
+ path_params: {'policyEventsResource' => policy_events_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name},
115
+ 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},
116
+ headers: request_headers.merge(custom_headers || {}),
117
+ base_url: request_url
118
+ }
119
+ promise = @client.make_request_async(:post, path_template, options)
120
+
121
+ promise = promise.then do |result|
122
+ http_response = result.response
123
+ status_code = http_response.status
124
+ response_content = http_response.body
125
+ unless status_code == 200
126
+ error_model = JSON.load(response_content)
127
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
128
+ end
129
+
130
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
131
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
132
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
133
+ # Deserialize Response
134
+ if status_code == 200
135
+ begin
136
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
137
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
138
+ result.body = @client.deserialize(result_mapper, parsed_response)
139
+ rescue Exception => e
140
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
141
+ end
142
+ end
143
+
144
+ result
145
+ end
146
+
147
+ promise.execute
148
+ end
149
+
150
+ #
151
+ # Queries policy events for the resources under the subscription.
152
+ #
153
+ # @param subscription_id [String] Microsoft Azure subscription ID.
154
+ # @param query_options [QueryOptions] Additional parameters for the operation
155
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
156
+ # will be added to the HTTP request.
157
+ #
158
+ # @return [Array<PolicyEvent>] operation results.
159
+ #
160
+ def list_query_results_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
161
+ first_page = list_query_results_for_subscription_as_lazy(subscription_id, query_options:query_options, custom_headers:custom_headers)
162
+ first_page.get_all_items
163
+ end
164
+
165
+ #
166
+ # Queries policy events for the resources under the subscription.
167
+ #
168
+ # @param subscription_id [String] Microsoft Azure subscription ID.
169
+ # @param query_options [QueryOptions] Additional parameters for the operation
170
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
171
+ # will be added to the HTTP request.
172
+ #
173
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
174
+ #
175
+ def list_query_results_for_subscription_with_http_info(subscription_id, query_options:nil, custom_headers:nil)
176
+ list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
177
+ end
178
+
179
+ #
180
+ # Queries policy events for the resources under the subscription.
181
+ #
182
+ # @param subscription_id [String] Microsoft Azure subscription ID.
183
+ # @param query_options [QueryOptions] Additional parameters for the operation
184
+ # @param [Hash{String => String}] A hash of custom headers that will be added
185
+ # to the HTTP request.
186
+ #
187
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
188
+ #
189
+ def list_query_results_for_subscription_async(subscription_id, query_options:nil, custom_headers:nil)
190
+ policy_events_resource = 'default'
191
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
192
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
193
+
194
+ top = nil
195
+ order_by = nil
196
+ select = nil
197
+ from = nil
198
+ to = nil
199
+ filter = nil
200
+ apply = nil
201
+ skip_token = nil
202
+ unless query_options.nil?
203
+ top = query_options.Top
204
+ end
205
+ unless query_options.nil?
206
+ order_by = query_options.OrderBy
207
+ end
208
+ unless query_options.nil?
209
+ select = query_options.Select
210
+ end
211
+ unless query_options.nil?
212
+ from = query_options.From
213
+ end
214
+ unless query_options.nil?
215
+ to = query_options.To
216
+ end
217
+ unless query_options.nil?
218
+ filter = query_options.Filter
219
+ end
220
+ unless query_options.nil?
221
+ apply = query_options.Apply
222
+ end
223
+ unless query_options.nil?
224
+ skip_token = query_options.SkipToken
225
+ end
226
+
227
+ request_headers = {}
228
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
229
+
230
+ # Set Headers
231
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
232
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
233
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
234
+
235
+ request_url = @base_url || @client.base_url
236
+
237
+ options = {
238
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
239
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id},
240
+ 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},
241
+ headers: request_headers.merge(custom_headers || {}),
242
+ base_url: request_url
243
+ }
244
+ promise = @client.make_request_async(:post, path_template, options)
245
+
246
+ promise = promise.then do |result|
247
+ http_response = result.response
248
+ status_code = http_response.status
249
+ response_content = http_response.body
250
+ unless status_code == 200
251
+ error_model = JSON.load(response_content)
252
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
253
+ end
254
+
255
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
256
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
257
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
258
+ # Deserialize Response
259
+ if status_code == 200
260
+ begin
261
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
262
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
263
+ result.body = @client.deserialize(result_mapper, parsed_response)
264
+ rescue Exception => e
265
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
266
+ end
267
+ end
268
+
269
+ result
270
+ end
271
+
272
+ promise.execute
273
+ end
274
+
275
+ #
276
+ # Queries policy events for the resources under the resource group.
277
+ #
278
+ # @param subscription_id [String] Microsoft Azure subscription ID.
279
+ # @param resource_group_name [String] Resource group name.
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<PolicyEvent>] operation results.
285
+ #
286
+ def list_query_results_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
287
+ first_page = list_query_results_for_resource_group_as_lazy(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers)
288
+ first_page.get_all_items
289
+ end
290
+
291
+ #
292
+ # Queries policy events for the resources under the resource group.
293
+ #
294
+ # @param subscription_id [String] Microsoft Azure subscription ID.
295
+ # @param resource_group_name [String] Resource group name.
296
+ # @param query_options [QueryOptions] Additional parameters for the operation
297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
+ # will be added to the HTTP request.
299
+ #
300
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
301
+ #
302
+ def list_query_results_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
303
+ list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
304
+ end
305
+
306
+ #
307
+ # Queries policy events for the resources under the resource group.
308
+ #
309
+ # @param subscription_id [String] Microsoft Azure subscription ID.
310
+ # @param resource_group_name [String] Resource group name.
311
+ # @param query_options [QueryOptions] Additional parameters for the operation
312
+ # @param [Hash{String => String}] A hash of custom headers that will be added
313
+ # to the HTTP request.
314
+ #
315
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
316
+ #
317
+ def list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
318
+ policy_events_resource = 'default'
319
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
320
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
321
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
322
+
323
+ top = nil
324
+ order_by = nil
325
+ select = nil
326
+ from = nil
327
+ to = nil
328
+ filter = nil
329
+ apply = nil
330
+ skip_token = nil
331
+ unless query_options.nil?
332
+ top = query_options.Top
333
+ end
334
+ unless query_options.nil?
335
+ order_by = query_options.OrderBy
336
+ end
337
+ unless query_options.nil?
338
+ select = query_options.Select
339
+ end
340
+ unless query_options.nil?
341
+ from = query_options.From
342
+ end
343
+ unless query_options.nil?
344
+ to = query_options.To
345
+ end
346
+ unless query_options.nil?
347
+ filter = query_options.Filter
348
+ end
349
+ unless query_options.nil?
350
+ apply = query_options.Apply
351
+ end
352
+ unless query_options.nil?
353
+ skip_token = query_options.SkipToken
354
+ end
355
+
356
+ request_headers = {}
357
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
358
+
359
+ # Set Headers
360
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
361
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
362
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
363
+
364
+ request_url = @base_url || @client.base_url
365
+
366
+ options = {
367
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
368
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
369
+ 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},
370
+ headers: request_headers.merge(custom_headers || {}),
371
+ base_url: request_url
372
+ }
373
+ promise = @client.make_request_async(:post, path_template, options)
374
+
375
+ promise = promise.then do |result|
376
+ http_response = result.response
377
+ status_code = http_response.status
378
+ response_content = http_response.body
379
+ unless status_code == 200
380
+ error_model = JSON.load(response_content)
381
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
382
+ end
383
+
384
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
385
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
386
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
387
+ # Deserialize Response
388
+ if status_code == 200
389
+ begin
390
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
391
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
392
+ result.body = @client.deserialize(result_mapper, parsed_response)
393
+ rescue Exception => e
394
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
395
+ end
396
+ end
397
+
398
+ result
399
+ end
400
+
401
+ promise.execute
402
+ end
403
+
404
+ #
405
+ # Queries policy events for the resource.
406
+ #
407
+ # @param resource_id [String] Resource ID.
408
+ # @param query_options [QueryOptions] Additional parameters for the operation
409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
410
+ # will be added to the HTTP request.
411
+ #
412
+ # @return [Array<PolicyEvent>] operation results.
413
+ #
414
+ def list_query_results_for_resource(resource_id, query_options:nil, custom_headers:nil)
415
+ first_page = list_query_results_for_resource_as_lazy(resource_id, query_options:query_options, custom_headers:custom_headers)
416
+ first_page.get_all_items
417
+ end
418
+
419
+ #
420
+ # Queries policy events for the resource.
421
+ #
422
+ # @param resource_id [String] Resource ID.
423
+ # @param query_options [QueryOptions] Additional parameters for the operation
424
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
425
+ # will be added to the HTTP request.
426
+ #
427
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
428
+ #
429
+ def list_query_results_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
430
+ list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
431
+ end
432
+
433
+ #
434
+ # Queries policy events for the resource.
435
+ #
436
+ # @param resource_id [String] Resource ID.
437
+ # @param query_options [QueryOptions] Additional parameters for the operation
438
+ # @param [Hash{String => String}] A hash of custom headers that will be added
439
+ # to the HTTP request.
440
+ #
441
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
442
+ #
443
+ def list_query_results_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
444
+ policy_events_resource = 'default'
445
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
446
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
447
+
448
+ top = nil
449
+ order_by = nil
450
+ select = nil
451
+ from = nil
452
+ to = nil
453
+ filter = nil
454
+ apply = nil
455
+ expand = nil
456
+ skip_token = nil
457
+ unless query_options.nil?
458
+ top = query_options.Top
459
+ end
460
+ unless query_options.nil?
461
+ order_by = query_options.OrderBy
462
+ end
463
+ unless query_options.nil?
464
+ select = query_options.Select
465
+ end
466
+ unless query_options.nil?
467
+ from = query_options.From
468
+ end
469
+ unless query_options.nil?
470
+ to = query_options.To
471
+ end
472
+ unless query_options.nil?
473
+ filter = query_options.Filter
474
+ end
475
+ unless query_options.nil?
476
+ apply = query_options.Apply
477
+ end
478
+ unless query_options.nil?
479
+ expand = query_options.Expand
480
+ end
481
+ unless query_options.nil?
482
+ skip_token = query_options.SkipToken
483
+ end
484
+
485
+ request_headers = {}
486
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
487
+
488
+ # Set Headers
489
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
490
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
491
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
492
+
493
+ request_url = @base_url || @client.base_url
494
+
495
+ options = {
496
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
497
+ path_params: {'policyEventsResource' => policy_events_resource},
498
+ skip_encoding_path_params: {'resourceId' => resource_id},
499
+ 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},
500
+ headers: request_headers.merge(custom_headers || {}),
501
+ base_url: request_url
502
+ }
503
+ promise = @client.make_request_async(:post, path_template, options)
504
+
505
+ promise = promise.then do |result|
506
+ http_response = result.response
507
+ status_code = http_response.status
508
+ response_content = http_response.body
509
+ unless status_code == 200
510
+ error_model = JSON.load(response_content)
511
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
512
+ end
513
+
514
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
515
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
516
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
517
+ # Deserialize Response
518
+ if status_code == 200
519
+ begin
520
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
521
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
522
+ result.body = @client.deserialize(result_mapper, parsed_response)
523
+ rescue Exception => e
524
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
525
+ end
526
+ end
527
+
528
+ result
529
+ end
530
+
531
+ promise.execute
532
+ end
533
+
534
+ #
535
+ # Queries policy events for the subscription level policy set definition.
536
+ #
537
+ # @param subscription_id [String] Microsoft Azure subscription ID.
538
+ # @param policy_set_definition_name [String] Policy set definition name.
539
+ # @param query_options [QueryOptions] Additional parameters for the operation
540
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
541
+ # will be added to the HTTP request.
542
+ #
543
+ # @return [Array<PolicyEvent>] operation results.
544
+ #
545
+ def list_query_results_for_policy_set_definition(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
546
+ first_page = list_query_results_for_policy_set_definition_as_lazy(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers)
547
+ first_page.get_all_items
548
+ end
549
+
550
+ #
551
+ # Queries policy events for the subscription level policy set definition.
552
+ #
553
+ # @param subscription_id [String] Microsoft Azure subscription ID.
554
+ # @param policy_set_definition_name [String] Policy set definition name.
555
+ # @param query_options [QueryOptions] Additional parameters for the operation
556
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
557
+ # will be added to the HTTP request.
558
+ #
559
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
560
+ #
561
+ def list_query_results_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
562
+ list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
563
+ end
564
+
565
+ #
566
+ # Queries policy events for the subscription level policy set definition.
567
+ #
568
+ # @param subscription_id [String] Microsoft Azure subscription ID.
569
+ # @param policy_set_definition_name [String] Policy set definition name.
570
+ # @param query_options [QueryOptions] Additional parameters for the operation
571
+ # @param [Hash{String => String}] A hash of custom headers that will be added
572
+ # to the HTTP request.
573
+ #
574
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
575
+ #
576
+ def list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
577
+ policy_events_resource = 'default'
578
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
579
+ authorization_namespace = 'Microsoft.Authorization'
580
+ fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
581
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
582
+
583
+ top = nil
584
+ order_by = nil
585
+ select = nil
586
+ from = nil
587
+ to = nil
588
+ filter = nil
589
+ apply = nil
590
+ skip_token = nil
591
+ unless query_options.nil?
592
+ top = query_options.Top
593
+ end
594
+ unless query_options.nil?
595
+ order_by = query_options.OrderBy
596
+ end
597
+ unless query_options.nil?
598
+ select = query_options.Select
599
+ end
600
+ unless query_options.nil?
601
+ from = query_options.From
602
+ end
603
+ unless query_options.nil?
604
+ to = query_options.To
605
+ end
606
+ unless query_options.nil?
607
+ filter = query_options.Filter
608
+ end
609
+ unless query_options.nil?
610
+ apply = query_options.Apply
611
+ end
612
+ unless query_options.nil?
613
+ skip_token = query_options.SkipToken
614
+ end
615
+
616
+ request_headers = {}
617
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
618
+
619
+ # Set Headers
620
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
621
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
622
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
623
+
624
+ request_url = @base_url || @client.base_url
625
+
626
+ options = {
627
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
628
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policySetDefinitionName' => policy_set_definition_name},
629
+ 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},
630
+ headers: request_headers.merge(custom_headers || {}),
631
+ base_url: request_url
632
+ }
633
+ promise = @client.make_request_async(:post, path_template, options)
634
+
635
+ promise = promise.then do |result|
636
+ http_response = result.response
637
+ status_code = http_response.status
638
+ response_content = http_response.body
639
+ unless status_code == 200
640
+ error_model = JSON.load(response_content)
641
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
642
+ end
643
+
644
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
645
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
646
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
647
+ # Deserialize Response
648
+ if status_code == 200
649
+ begin
650
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
651
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
652
+ result.body = @client.deserialize(result_mapper, parsed_response)
653
+ rescue Exception => e
654
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
655
+ end
656
+ end
657
+
658
+ result
659
+ end
660
+
661
+ promise.execute
662
+ end
663
+
664
+ #
665
+ # Queries policy events for the subscription level policy definition.
666
+ #
667
+ # @param subscription_id [String] Microsoft Azure subscription ID.
668
+ # @param policy_definition_name [String] Policy definition name.
669
+ # @param query_options [QueryOptions] Additional parameters for the operation
670
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
671
+ # will be added to the HTTP request.
672
+ #
673
+ # @return [Array<PolicyEvent>] operation results.
674
+ #
675
+ def list_query_results_for_policy_definition(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
676
+ first_page = list_query_results_for_policy_definition_as_lazy(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers)
677
+ first_page.get_all_items
678
+ end
679
+
680
+ #
681
+ # Queries policy events for the subscription level policy definition.
682
+ #
683
+ # @param subscription_id [String] Microsoft Azure subscription ID.
684
+ # @param policy_definition_name [String] Policy definition name.
685
+ # @param query_options [QueryOptions] Additional parameters for the operation
686
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
687
+ # will be added to the HTTP request.
688
+ #
689
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
690
+ #
691
+ def list_query_results_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
692
+ list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
693
+ end
694
+
695
+ #
696
+ # Queries policy events for the subscription level policy definition.
697
+ #
698
+ # @param subscription_id [String] Microsoft Azure subscription ID.
699
+ # @param policy_definition_name [String] Policy definition name.
700
+ # @param query_options [QueryOptions] Additional parameters for the operation
701
+ # @param [Hash{String => String}] A hash of custom headers that will be added
702
+ # to the HTTP request.
703
+ #
704
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
705
+ #
706
+ def list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
707
+ policy_events_resource = 'default'
708
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
709
+ authorization_namespace = 'Microsoft.Authorization'
710
+ fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
711
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
712
+
713
+ top = nil
714
+ order_by = nil
715
+ select = nil
716
+ from = nil
717
+ to = nil
718
+ filter = nil
719
+ apply = nil
720
+ skip_token = nil
721
+ unless query_options.nil?
722
+ top = query_options.Top
723
+ end
724
+ unless query_options.nil?
725
+ order_by = query_options.OrderBy
726
+ end
727
+ unless query_options.nil?
728
+ select = query_options.Select
729
+ end
730
+ unless query_options.nil?
731
+ from = query_options.From
732
+ end
733
+ unless query_options.nil?
734
+ to = query_options.To
735
+ end
736
+ unless query_options.nil?
737
+ filter = query_options.Filter
738
+ end
739
+ unless query_options.nil?
740
+ apply = query_options.Apply
741
+ end
742
+ unless query_options.nil?
743
+ skip_token = query_options.SkipToken
744
+ end
745
+
746
+ request_headers = {}
747
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
748
+
749
+ # Set Headers
750
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
751
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
752
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
753
+
754
+ request_url = @base_url || @client.base_url
755
+
756
+ options = {
757
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
758
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyDefinitionName' => policy_definition_name},
759
+ 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},
760
+ headers: request_headers.merge(custom_headers || {}),
761
+ base_url: request_url
762
+ }
763
+ promise = @client.make_request_async(:post, path_template, options)
764
+
765
+ promise = promise.then do |result|
766
+ http_response = result.response
767
+ status_code = http_response.status
768
+ response_content = http_response.body
769
+ unless status_code == 200
770
+ error_model = JSON.load(response_content)
771
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
772
+ end
773
+
774
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
775
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
776
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
777
+ # Deserialize Response
778
+ if status_code == 200
779
+ begin
780
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
781
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
782
+ result.body = @client.deserialize(result_mapper, parsed_response)
783
+ rescue Exception => e
784
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
785
+ end
786
+ end
787
+
788
+ result
789
+ end
790
+
791
+ promise.execute
792
+ end
793
+
794
+ #
795
+ # Queries policy events for the subscription level policy assignment.
796
+ #
797
+ # @param subscription_id [String] Microsoft Azure subscription ID.
798
+ # @param policy_assignment_name [String] Policy assignment name.
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 [Array<PolicyEvent>] operation results.
804
+ #
805
+ def list_query_results_for_subscription_level_policy_assignment(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
806
+ first_page = list_query_results_for_subscription_level_policy_assignment_as_lazy(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers)
807
+ first_page.get_all_items
808
+ end
809
+
810
+ #
811
+ # Queries policy events for the subscription level policy assignment.
812
+ #
813
+ # @param subscription_id [String] Microsoft Azure subscription ID.
814
+ # @param policy_assignment_name [String] Policy assignment name.
815
+ # @param query_options [QueryOptions] Additional parameters for the operation
816
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
817
+ # will be added to the HTTP request.
818
+ #
819
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
820
+ #
821
+ def list_query_results_for_subscription_level_policy_assignment_with_http_info(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
822
+ list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
823
+ end
824
+
825
+ #
826
+ # Queries policy events for the subscription level policy assignment.
827
+ #
828
+ # @param subscription_id [String] Microsoft Azure subscription ID.
829
+ # @param policy_assignment_name [String] Policy assignment name.
830
+ # @param query_options [QueryOptions] Additional parameters for the operation
831
+ # @param [Hash{String => String}] A hash of custom headers that will be added
832
+ # to the HTTP request.
833
+ #
834
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
835
+ #
836
+ def list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
837
+ policy_events_resource = 'default'
838
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
839
+ authorization_namespace = 'Microsoft.Authorization'
840
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
841
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
842
+
843
+ top = nil
844
+ order_by = nil
845
+ select = nil
846
+ from = nil
847
+ to = nil
848
+ filter = nil
849
+ apply = nil
850
+ skip_token = nil
851
+ unless query_options.nil?
852
+ top = query_options.Top
853
+ end
854
+ unless query_options.nil?
855
+ order_by = query_options.OrderBy
856
+ end
857
+ unless query_options.nil?
858
+ select = query_options.Select
859
+ end
860
+ unless query_options.nil?
861
+ from = query_options.From
862
+ end
863
+ unless query_options.nil?
864
+ to = query_options.To
865
+ end
866
+ unless query_options.nil?
867
+ filter = query_options.Filter
868
+ end
869
+ unless query_options.nil?
870
+ apply = query_options.Apply
871
+ end
872
+ unless query_options.nil?
873
+ skip_token = query_options.SkipToken
874
+ end
875
+
876
+ request_headers = {}
877
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
878
+
879
+ # Set Headers
880
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
881
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
882
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
883
+
884
+ request_url = @base_url || @client.base_url
885
+
886
+ options = {
887
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
888
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
889
+ 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},
890
+ headers: request_headers.merge(custom_headers || {}),
891
+ base_url: request_url
892
+ }
893
+ promise = @client.make_request_async(:post, path_template, options)
894
+
895
+ promise = promise.then do |result|
896
+ http_response = result.response
897
+ status_code = http_response.status
898
+ response_content = http_response.body
899
+ unless status_code == 200
900
+ error_model = JSON.load(response_content)
901
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
902
+ end
903
+
904
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
905
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
906
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
907
+ # Deserialize Response
908
+ if status_code == 200
909
+ begin
910
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
911
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
912
+ result.body = @client.deserialize(result_mapper, parsed_response)
913
+ rescue Exception => e
914
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
915
+ end
916
+ end
917
+
918
+ result
919
+ end
920
+
921
+ promise.execute
922
+ end
923
+
924
+ #
925
+ # Queries policy events for the resource group level policy assignment.
926
+ #
927
+ # @param subscription_id [String] Microsoft Azure subscription ID.
928
+ # @param resource_group_name [String] Resource group name.
929
+ # @param policy_assignment_name [String] Policy assignment name.
930
+ # @param query_options [QueryOptions] Additional parameters for the operation
931
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
932
+ # will be added to the HTTP request.
933
+ #
934
+ # @return [Array<PolicyEvent>] operation results.
935
+ #
936
+ def list_query_results_for_resource_group_level_policy_assignment(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
937
+ first_page = list_query_results_for_resource_group_level_policy_assignment_as_lazy(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers)
938
+ first_page.get_all_items
939
+ end
940
+
941
+ #
942
+ # Queries policy events for the resource group level policy assignment.
943
+ #
944
+ # @param subscription_id [String] Microsoft Azure subscription ID.
945
+ # @param resource_group_name [String] Resource group name.
946
+ # @param policy_assignment_name [String] Policy assignment name.
947
+ # @param query_options [QueryOptions] Additional parameters for the operation
948
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
949
+ # will be added to the HTTP request.
950
+ #
951
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
952
+ #
953
+ def list_query_results_for_resource_group_level_policy_assignment_with_http_info(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
954
+ list_query_results_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
955
+ end
956
+
957
+ #
958
+ # Queries policy events for the resource group level policy assignment.
959
+ #
960
+ # @param subscription_id [String] Microsoft Azure subscription ID.
961
+ # @param resource_group_name [String] Resource group name.
962
+ # @param policy_assignment_name [String] Policy assignment name.
963
+ # @param query_options [QueryOptions] Additional parameters for the operation
964
+ # @param [Hash{String => String}] A hash of custom headers that will be added
965
+ # to the HTTP request.
966
+ #
967
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
968
+ #
969
+ def list_query_results_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
970
+ policy_events_resource = 'default'
971
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
972
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
973
+ authorization_namespace = 'Microsoft.Authorization'
974
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
975
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
976
+
977
+ top = nil
978
+ order_by = nil
979
+ select = nil
980
+ from = nil
981
+ to = nil
982
+ filter = nil
983
+ apply = nil
984
+ skip_token = nil
985
+ unless query_options.nil?
986
+ top = query_options.Top
987
+ end
988
+ unless query_options.nil?
989
+ order_by = query_options.OrderBy
990
+ end
991
+ unless query_options.nil?
992
+ select = query_options.Select
993
+ end
994
+ unless query_options.nil?
995
+ from = query_options.From
996
+ end
997
+ unless query_options.nil?
998
+ to = query_options.To
999
+ end
1000
+ unless query_options.nil?
1001
+ filter = query_options.Filter
1002
+ end
1003
+ unless query_options.nil?
1004
+ apply = query_options.Apply
1005
+ end
1006
+ unless query_options.nil?
1007
+ skip_token = query_options.SkipToken
1008
+ end
1009
+
1010
+ request_headers = {}
1011
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1012
+
1013
+ # Set Headers
1014
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1015
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1016
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
1017
+
1018
+ request_url = @base_url || @client.base_url
1019
+
1020
+ options = {
1021
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1022
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
1023
+ 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},
1024
+ headers: request_headers.merge(custom_headers || {}),
1025
+ base_url: request_url
1026
+ }
1027
+ promise = @client.make_request_async(:post, path_template, options)
1028
+
1029
+ promise = promise.then do |result|
1030
+ http_response = result.response
1031
+ status_code = http_response.status
1032
+ response_content = http_response.body
1033
+ unless status_code == 200
1034
+ error_model = JSON.load(response_content)
1035
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1036
+ end
1037
+
1038
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1039
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1040
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1041
+ # Deserialize Response
1042
+ if status_code == 200
1043
+ begin
1044
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1045
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1046
+ result.body = @client.deserialize(result_mapper, parsed_response)
1047
+ rescue Exception => e
1048
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1049
+ end
1050
+ end
1051
+
1052
+ result
1053
+ end
1054
+
1055
+ promise.execute
1056
+ end
1057
+
1058
+ #
1059
+ # Queries policy events for the resources under the management group.
1060
+ #
1061
+ # @param next_page_link [String] The NextLink from the previous successful call
1062
+ # to List operation.
1063
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1064
+ # will be added to the HTTP request.
1065
+ #
1066
+ # @return [PolicyEventsQueryResults] operation results.
1067
+ #
1068
+ def list_query_results_for_management_group_next(next_page_link, custom_headers:nil)
1069
+ response = list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
1070
+ response.body unless response.nil?
1071
+ end
1072
+
1073
+ #
1074
+ # Queries policy events for the resources under the management group.
1075
+ #
1076
+ # @param next_page_link [String] The NextLink from the previous successful call
1077
+ # to List operation.
1078
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1079
+ # will be added to the HTTP request.
1080
+ #
1081
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1082
+ #
1083
+ def list_query_results_for_management_group_next_with_http_info(next_page_link, custom_headers:nil)
1084
+ list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers).value!
1085
+ end
1086
+
1087
+ #
1088
+ # Queries policy events for the resources under the management group.
1089
+ #
1090
+ # @param next_page_link [String] The NextLink from the previous successful call
1091
+ # to List operation.
1092
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1093
+ # to the HTTP request.
1094
+ #
1095
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1096
+ #
1097
+ def list_query_results_for_management_group_next_async(next_page_link, custom_headers:nil)
1098
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1099
+
1100
+
1101
+ request_headers = {}
1102
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1103
+
1104
+ # Set Headers
1105
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1106
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1107
+ path_template = '{nextLink}'
1108
+
1109
+ request_url = @base_url || @client.base_url
1110
+
1111
+ options = {
1112
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1113
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1114
+ headers: request_headers.merge(custom_headers || {}),
1115
+ base_url: request_url
1116
+ }
1117
+ promise = @client.make_request_async(:post, path_template, options)
1118
+
1119
+ promise = promise.then do |result|
1120
+ http_response = result.response
1121
+ status_code = http_response.status
1122
+ response_content = http_response.body
1123
+ unless status_code == 200
1124
+ error_model = JSON.load(response_content)
1125
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1126
+ end
1127
+
1128
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1129
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1130
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1131
+ # Deserialize Response
1132
+ if status_code == 200
1133
+ begin
1134
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1135
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1136
+ result.body = @client.deserialize(result_mapper, parsed_response)
1137
+ rescue Exception => e
1138
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1139
+ end
1140
+ end
1141
+
1142
+ result
1143
+ end
1144
+
1145
+ promise.execute
1146
+ end
1147
+
1148
+ #
1149
+ # Queries policy events for the resources under the subscription.
1150
+ #
1151
+ # @param next_page_link [String] The NextLink from the previous successful call
1152
+ # to List operation.
1153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1154
+ # will be added to the HTTP request.
1155
+ #
1156
+ # @return [PolicyEventsQueryResults] operation results.
1157
+ #
1158
+ def list_query_results_for_subscription_next(next_page_link, custom_headers:nil)
1159
+ response = list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
1160
+ response.body unless response.nil?
1161
+ end
1162
+
1163
+ #
1164
+ # Queries policy events for the resources under the subscription.
1165
+ #
1166
+ # @param next_page_link [String] The NextLink from the previous successful call
1167
+ # to List operation.
1168
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1169
+ # will be added to the HTTP request.
1170
+ #
1171
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1172
+ #
1173
+ def list_query_results_for_subscription_next_with_http_info(next_page_link, custom_headers:nil)
1174
+ list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers).value!
1175
+ end
1176
+
1177
+ #
1178
+ # Queries policy events for the resources under the subscription.
1179
+ #
1180
+ # @param next_page_link [String] The NextLink from the previous successful call
1181
+ # to List operation.
1182
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1183
+ # to the HTTP request.
1184
+ #
1185
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1186
+ #
1187
+ def list_query_results_for_subscription_next_async(next_page_link, custom_headers:nil)
1188
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1189
+
1190
+
1191
+ request_headers = {}
1192
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1193
+
1194
+ # Set Headers
1195
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1196
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1197
+ path_template = '{nextLink}'
1198
+
1199
+ request_url = @base_url || @client.base_url
1200
+
1201
+ options = {
1202
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1203
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1204
+ headers: request_headers.merge(custom_headers || {}),
1205
+ base_url: request_url
1206
+ }
1207
+ promise = @client.make_request_async(:post, path_template, options)
1208
+
1209
+ promise = promise.then do |result|
1210
+ http_response = result.response
1211
+ status_code = http_response.status
1212
+ response_content = http_response.body
1213
+ unless status_code == 200
1214
+ error_model = JSON.load(response_content)
1215
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1216
+ end
1217
+
1218
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1219
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1220
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1221
+ # Deserialize Response
1222
+ if status_code == 200
1223
+ begin
1224
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1225
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1226
+ result.body = @client.deserialize(result_mapper, parsed_response)
1227
+ rescue Exception => e
1228
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1229
+ end
1230
+ end
1231
+
1232
+ result
1233
+ end
1234
+
1235
+ promise.execute
1236
+ end
1237
+
1238
+ #
1239
+ # Queries policy events for the resources under the resource group.
1240
+ #
1241
+ # @param next_page_link [String] The NextLink from the previous successful call
1242
+ # to List operation.
1243
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1244
+ # will be added to the HTTP request.
1245
+ #
1246
+ # @return [PolicyEventsQueryResults] operation results.
1247
+ #
1248
+ def list_query_results_for_resource_group_next(next_page_link, custom_headers:nil)
1249
+ response = list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1250
+ response.body unless response.nil?
1251
+ end
1252
+
1253
+ #
1254
+ # Queries policy events for the resources under the resource group.
1255
+ #
1256
+ # @param next_page_link [String] The NextLink from the previous successful call
1257
+ # to List operation.
1258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1259
+ # will be added to the HTTP request.
1260
+ #
1261
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1262
+ #
1263
+ def list_query_results_for_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1264
+ list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1265
+ end
1266
+
1267
+ #
1268
+ # Queries policy events for the resources under the resource group.
1269
+ #
1270
+ # @param next_page_link [String] The NextLink from the previous successful call
1271
+ # to List operation.
1272
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1273
+ # to the HTTP request.
1274
+ #
1275
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1276
+ #
1277
+ def list_query_results_for_resource_group_next_async(next_page_link, custom_headers:nil)
1278
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1279
+
1280
+
1281
+ request_headers = {}
1282
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1283
+
1284
+ # Set Headers
1285
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1286
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1287
+ path_template = '{nextLink}'
1288
+
1289
+ request_url = @base_url || @client.base_url
1290
+
1291
+ options = {
1292
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1293
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1294
+ headers: request_headers.merge(custom_headers || {}),
1295
+ base_url: request_url
1296
+ }
1297
+ promise = @client.make_request_async(:post, path_template, options)
1298
+
1299
+ promise = promise.then do |result|
1300
+ http_response = result.response
1301
+ status_code = http_response.status
1302
+ response_content = http_response.body
1303
+ unless status_code == 200
1304
+ error_model = JSON.load(response_content)
1305
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1306
+ end
1307
+
1308
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1309
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1310
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1311
+ # Deserialize Response
1312
+ if status_code == 200
1313
+ begin
1314
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1315
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1316
+ result.body = @client.deserialize(result_mapper, parsed_response)
1317
+ rescue Exception => e
1318
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1319
+ end
1320
+ end
1321
+
1322
+ result
1323
+ end
1324
+
1325
+ promise.execute
1326
+ end
1327
+
1328
+ #
1329
+ # Queries policy events for the resource.
1330
+ #
1331
+ # @param next_page_link [String] The NextLink from the previous successful call
1332
+ # to List operation.
1333
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1334
+ # will be added to the HTTP request.
1335
+ #
1336
+ # @return [PolicyEventsQueryResults] operation results.
1337
+ #
1338
+ def list_query_results_for_resource_next(next_page_link, custom_headers:nil)
1339
+ response = list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
1340
+ response.body unless response.nil?
1341
+ end
1342
+
1343
+ #
1344
+ # Queries policy events for the resource.
1345
+ #
1346
+ # @param next_page_link [String] The NextLink from the previous successful call
1347
+ # to List operation.
1348
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1349
+ # will be added to the HTTP request.
1350
+ #
1351
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1352
+ #
1353
+ def list_query_results_for_resource_next_with_http_info(next_page_link, custom_headers:nil)
1354
+ list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers).value!
1355
+ end
1356
+
1357
+ #
1358
+ # Queries policy events for the resource.
1359
+ #
1360
+ # @param next_page_link [String] The NextLink from the previous successful call
1361
+ # to List operation.
1362
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1363
+ # to the HTTP request.
1364
+ #
1365
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1366
+ #
1367
+ def list_query_results_for_resource_next_async(next_page_link, custom_headers:nil)
1368
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1369
+
1370
+
1371
+ request_headers = {}
1372
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1373
+
1374
+ # Set Headers
1375
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1376
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1377
+ path_template = '{nextLink}'
1378
+
1379
+ request_url = @base_url || @client.base_url
1380
+
1381
+ options = {
1382
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1383
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1384
+ headers: request_headers.merge(custom_headers || {}),
1385
+ base_url: request_url
1386
+ }
1387
+ promise = @client.make_request_async(:post, path_template, options)
1388
+
1389
+ promise = promise.then do |result|
1390
+ http_response = result.response
1391
+ status_code = http_response.status
1392
+ response_content = http_response.body
1393
+ unless status_code == 200
1394
+ error_model = JSON.load(response_content)
1395
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1396
+ end
1397
+
1398
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1399
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1400
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1401
+ # Deserialize Response
1402
+ if status_code == 200
1403
+ begin
1404
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1405
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1406
+ result.body = @client.deserialize(result_mapper, parsed_response)
1407
+ rescue Exception => e
1408
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1409
+ end
1410
+ end
1411
+
1412
+ result
1413
+ end
1414
+
1415
+ promise.execute
1416
+ end
1417
+
1418
+ #
1419
+ # Queries policy events for the subscription level policy set definition.
1420
+ #
1421
+ # @param next_page_link [String] The NextLink from the previous successful call
1422
+ # to List operation.
1423
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1424
+ # will be added to the HTTP request.
1425
+ #
1426
+ # @return [PolicyEventsQueryResults] operation results.
1427
+ #
1428
+ def list_query_results_for_policy_set_definition_next(next_page_link, custom_headers:nil)
1429
+ response = list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers).value!
1430
+ response.body unless response.nil?
1431
+ end
1432
+
1433
+ #
1434
+ # Queries policy events for the subscription level policy set definition.
1435
+ #
1436
+ # @param next_page_link [String] The NextLink from the previous successful call
1437
+ # to List operation.
1438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1439
+ # will be added to the HTTP request.
1440
+ #
1441
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1442
+ #
1443
+ def list_query_results_for_policy_set_definition_next_with_http_info(next_page_link, custom_headers:nil)
1444
+ list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers).value!
1445
+ end
1446
+
1447
+ #
1448
+ # Queries policy events for the subscription level policy set definition.
1449
+ #
1450
+ # @param next_page_link [String] The NextLink from the previous successful call
1451
+ # to List operation.
1452
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1453
+ # to the HTTP request.
1454
+ #
1455
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1456
+ #
1457
+ def list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:nil)
1458
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1459
+
1460
+
1461
+ request_headers = {}
1462
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1463
+
1464
+ # Set Headers
1465
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1466
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1467
+ path_template = '{nextLink}'
1468
+
1469
+ request_url = @base_url || @client.base_url
1470
+
1471
+ options = {
1472
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1473
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1474
+ headers: request_headers.merge(custom_headers || {}),
1475
+ base_url: request_url
1476
+ }
1477
+ promise = @client.make_request_async(:post, path_template, options)
1478
+
1479
+ promise = promise.then do |result|
1480
+ http_response = result.response
1481
+ status_code = http_response.status
1482
+ response_content = http_response.body
1483
+ unless status_code == 200
1484
+ error_model = JSON.load(response_content)
1485
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1486
+ end
1487
+
1488
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1489
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1490
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1491
+ # Deserialize Response
1492
+ if status_code == 200
1493
+ begin
1494
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1495
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1496
+ result.body = @client.deserialize(result_mapper, parsed_response)
1497
+ rescue Exception => e
1498
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1499
+ end
1500
+ end
1501
+
1502
+ result
1503
+ end
1504
+
1505
+ promise.execute
1506
+ end
1507
+
1508
+ #
1509
+ # Queries policy events for the subscription level policy definition.
1510
+ #
1511
+ # @param next_page_link [String] The NextLink from the previous successful call
1512
+ # to List operation.
1513
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1514
+ # will be added to the HTTP request.
1515
+ #
1516
+ # @return [PolicyEventsQueryResults] operation results.
1517
+ #
1518
+ def list_query_results_for_policy_definition_next(next_page_link, custom_headers:nil)
1519
+ response = list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers).value!
1520
+ response.body unless response.nil?
1521
+ end
1522
+
1523
+ #
1524
+ # Queries policy events for the subscription level policy definition.
1525
+ #
1526
+ # @param next_page_link [String] The NextLink from the previous successful call
1527
+ # to List operation.
1528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1529
+ # will be added to the HTTP request.
1530
+ #
1531
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1532
+ #
1533
+ def list_query_results_for_policy_definition_next_with_http_info(next_page_link, custom_headers:nil)
1534
+ list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers).value!
1535
+ end
1536
+
1537
+ #
1538
+ # Queries policy events for the subscription level policy definition.
1539
+ #
1540
+ # @param next_page_link [String] The NextLink from the previous successful call
1541
+ # to List operation.
1542
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1543
+ # to the HTTP request.
1544
+ #
1545
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1546
+ #
1547
+ def list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:nil)
1548
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1549
+
1550
+
1551
+ request_headers = {}
1552
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1553
+
1554
+ # Set Headers
1555
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1556
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1557
+ path_template = '{nextLink}'
1558
+
1559
+ request_url = @base_url || @client.base_url
1560
+
1561
+ options = {
1562
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1563
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1564
+ headers: request_headers.merge(custom_headers || {}),
1565
+ base_url: request_url
1566
+ }
1567
+ promise = @client.make_request_async(:post, path_template, options)
1568
+
1569
+ promise = promise.then do |result|
1570
+ http_response = result.response
1571
+ status_code = http_response.status
1572
+ response_content = http_response.body
1573
+ unless status_code == 200
1574
+ error_model = JSON.load(response_content)
1575
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1576
+ end
1577
+
1578
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1579
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1580
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1581
+ # Deserialize Response
1582
+ if status_code == 200
1583
+ begin
1584
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1585
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1586
+ result.body = @client.deserialize(result_mapper, parsed_response)
1587
+ rescue Exception => e
1588
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1589
+ end
1590
+ end
1591
+
1592
+ result
1593
+ end
1594
+
1595
+ promise.execute
1596
+ end
1597
+
1598
+ #
1599
+ # Queries policy events for the subscription level policy assignment.
1600
+ #
1601
+ # @param next_page_link [String] The NextLink from the previous successful call
1602
+ # to List operation.
1603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1604
+ # will be added to the HTTP request.
1605
+ #
1606
+ # @return [PolicyEventsQueryResults] operation results.
1607
+ #
1608
+ def list_query_results_for_subscription_level_policy_assignment_next(next_page_link, custom_headers:nil)
1609
+ response = list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
1610
+ response.body unless response.nil?
1611
+ end
1612
+
1613
+ #
1614
+ # Queries policy events for the subscription level policy assignment.
1615
+ #
1616
+ # @param next_page_link [String] The NextLink from the previous successful call
1617
+ # to List operation.
1618
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1619
+ # will be added to the HTTP request.
1620
+ #
1621
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1622
+ #
1623
+ def list_query_results_for_subscription_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil)
1624
+ list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
1625
+ end
1626
+
1627
+ #
1628
+ # Queries policy events for the subscription level policy assignment.
1629
+ #
1630
+ # @param next_page_link [String] The NextLink from the previous successful call
1631
+ # to List operation.
1632
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1633
+ # to the HTTP request.
1634
+ #
1635
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1636
+ #
1637
+ def list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:nil)
1638
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1639
+
1640
+
1641
+ request_headers = {}
1642
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1643
+
1644
+ # Set Headers
1645
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1646
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1647
+ path_template = '{nextLink}'
1648
+
1649
+ request_url = @base_url || @client.base_url
1650
+
1651
+ options = {
1652
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1653
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1654
+ headers: request_headers.merge(custom_headers || {}),
1655
+ base_url: request_url
1656
+ }
1657
+ promise = @client.make_request_async(:post, path_template, options)
1658
+
1659
+ promise = promise.then do |result|
1660
+ http_response = result.response
1661
+ status_code = http_response.status
1662
+ response_content = http_response.body
1663
+ unless status_code == 200
1664
+ error_model = JSON.load(response_content)
1665
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1666
+ end
1667
+
1668
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1669
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1670
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1671
+ # Deserialize Response
1672
+ if status_code == 200
1673
+ begin
1674
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1675
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1676
+ result.body = @client.deserialize(result_mapper, parsed_response)
1677
+ rescue Exception => e
1678
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1679
+ end
1680
+ end
1681
+
1682
+ result
1683
+ end
1684
+
1685
+ promise.execute
1686
+ end
1687
+
1688
+ #
1689
+ # Queries policy events for the resource group level policy assignment.
1690
+ #
1691
+ # @param next_page_link [String] The NextLink from the previous successful call
1692
+ # to List operation.
1693
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1694
+ # will be added to the HTTP request.
1695
+ #
1696
+ # @return [PolicyEventsQueryResults] operation results.
1697
+ #
1698
+ def list_query_results_for_resource_group_level_policy_assignment_next(next_page_link, custom_headers:nil)
1699
+ response = list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
1700
+ response.body unless response.nil?
1701
+ end
1702
+
1703
+ #
1704
+ # Queries policy events for the resource group level policy assignment.
1705
+ #
1706
+ # @param next_page_link [String] The NextLink from the previous successful call
1707
+ # to List operation.
1708
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1709
+ # will be added to the HTTP request.
1710
+ #
1711
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1712
+ #
1713
+ def list_query_results_for_resource_group_level_policy_assignment_next_with_http_info(next_page_link, custom_headers:nil)
1714
+ list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers).value!
1715
+ end
1716
+
1717
+ #
1718
+ # Queries policy events for the resource group level policy assignment.
1719
+ #
1720
+ # @param next_page_link [String] The NextLink from the previous successful call
1721
+ # to List operation.
1722
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1723
+ # to the HTTP request.
1724
+ #
1725
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1726
+ #
1727
+ def list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:nil)
1728
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1729
+
1730
+
1731
+ request_headers = {}
1732
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1733
+
1734
+ # Set Headers
1735
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1736
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1737
+ path_template = '{nextLink}'
1738
+
1739
+ request_url = @base_url || @client.base_url
1740
+
1741
+ options = {
1742
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1743
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1744
+ headers: request_headers.merge(custom_headers || {}),
1745
+ base_url: request_url
1746
+ }
1747
+ promise = @client.make_request_async(:post, path_template, options)
1748
+
1749
+ promise = promise.then do |result|
1750
+ http_response = result.response
1751
+ status_code = http_response.status
1752
+ response_content = http_response.body
1753
+ unless status_code == 200
1754
+ error_model = JSON.load(response_content)
1755
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1756
+ end
1757
+
1758
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1759
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1760
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1761
+ # Deserialize Response
1762
+ if status_code == 200
1763
+ begin
1764
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1765
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyEventsQueryResults.mapper()
1766
+ result.body = @client.deserialize(result_mapper, parsed_response)
1767
+ rescue Exception => e
1768
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1769
+ end
1770
+ end
1771
+
1772
+ result
1773
+ end
1774
+
1775
+ promise.execute
1776
+ end
1777
+
1778
+ #
1779
+ # Queries policy events for the resources under the management group.
1780
+ #
1781
+ # @param management_group_name [String] Management group name.
1782
+ # @param query_options [QueryOptions] Additional parameters for the operation
1783
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1784
+ # will be added to the HTTP request.
1785
+ #
1786
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1787
+ # response.
1788
+ #
1789
+ def list_query_results_for_management_group_as_lazy(management_group_name, query_options:nil, custom_headers:nil)
1790
+ response = list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
1791
+ unless response.nil?
1792
+ page = response.body
1793
+ page.next_method = Proc.new do |next_page_link|
1794
+ list_query_results_for_management_group_next_async(next_page_link, custom_headers:custom_headers)
1795
+ end
1796
+ page
1797
+ end
1798
+ end
1799
+
1800
+ #
1801
+ # Queries policy events for the resources under the subscription.
1802
+ #
1803
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1804
+ # @param query_options [QueryOptions] Additional parameters for the operation
1805
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1806
+ # will be added to the HTTP request.
1807
+ #
1808
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1809
+ # response.
1810
+ #
1811
+ def list_query_results_for_subscription_as_lazy(subscription_id, query_options:nil, custom_headers:nil)
1812
+ response = list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
1813
+ unless response.nil?
1814
+ page = response.body
1815
+ page.next_method = Proc.new do |next_page_link|
1816
+ list_query_results_for_subscription_next_async(next_page_link, custom_headers:custom_headers)
1817
+ end
1818
+ page
1819
+ end
1820
+ end
1821
+
1822
+ #
1823
+ # Queries policy events for the resources under the resource group.
1824
+ #
1825
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1826
+ # @param resource_group_name [String] Resource group name.
1827
+ # @param query_options [QueryOptions] Additional parameters for the operation
1828
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1829
+ # will be added to the HTTP request.
1830
+ #
1831
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1832
+ # response.
1833
+ #
1834
+ def list_query_results_for_resource_group_as_lazy(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
1835
+ response = list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
1836
+ unless response.nil?
1837
+ page = response.body
1838
+ page.next_method = Proc.new do |next_page_link|
1839
+ list_query_results_for_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1840
+ end
1841
+ page
1842
+ end
1843
+ end
1844
+
1845
+ #
1846
+ # Queries policy events for the resource.
1847
+ #
1848
+ # @param resource_id [String] Resource ID.
1849
+ # @param query_options [QueryOptions] Additional parameters for the operation
1850
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1851
+ # will be added to the HTTP request.
1852
+ #
1853
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1854
+ # response.
1855
+ #
1856
+ def list_query_results_for_resource_as_lazy(resource_id, query_options:nil, custom_headers:nil)
1857
+ response = list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
1858
+ unless response.nil?
1859
+ page = response.body
1860
+ page.next_method = Proc.new do |next_page_link|
1861
+ list_query_results_for_resource_next_async(next_page_link, custom_headers:custom_headers)
1862
+ end
1863
+ page
1864
+ end
1865
+ end
1866
+
1867
+ #
1868
+ # Queries policy events for the subscription level policy set definition.
1869
+ #
1870
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1871
+ # @param policy_set_definition_name [String] Policy set definition name.
1872
+ # @param query_options [QueryOptions] Additional parameters for the operation
1873
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1874
+ # will be added to the HTTP request.
1875
+ #
1876
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1877
+ # response.
1878
+ #
1879
+ def list_query_results_for_policy_set_definition_as_lazy(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
1880
+ response = list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1881
+ unless response.nil?
1882
+ page = response.body
1883
+ page.next_method = Proc.new do |next_page_link|
1884
+ list_query_results_for_policy_set_definition_next_async(next_page_link, custom_headers:custom_headers)
1885
+ end
1886
+ page
1887
+ end
1888
+ end
1889
+
1890
+ #
1891
+ # Queries policy events for the subscription level policy definition.
1892
+ #
1893
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1894
+ # @param policy_definition_name [String] Policy definition name.
1895
+ # @param query_options [QueryOptions] Additional parameters for the operation
1896
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1897
+ # will be added to the HTTP request.
1898
+ #
1899
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1900
+ # response.
1901
+ #
1902
+ def list_query_results_for_policy_definition_as_lazy(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
1903
+ response = list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
1904
+ unless response.nil?
1905
+ page = response.body
1906
+ page.next_method = Proc.new do |next_page_link|
1907
+ list_query_results_for_policy_definition_next_async(next_page_link, custom_headers:custom_headers)
1908
+ end
1909
+ page
1910
+ end
1911
+ end
1912
+
1913
+ #
1914
+ # Queries policy events for the subscription level policy assignment.
1915
+ #
1916
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1917
+ # @param policy_assignment_name [String] Policy assignment name.
1918
+ # @param query_options [QueryOptions] Additional parameters for the operation
1919
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1920
+ # will be added to the HTTP request.
1921
+ #
1922
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1923
+ # response.
1924
+ #
1925
+ def list_query_results_for_subscription_level_policy_assignment_as_lazy(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
1926
+ response = list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1927
+ unless response.nil?
1928
+ page = response.body
1929
+ page.next_method = Proc.new do |next_page_link|
1930
+ list_query_results_for_subscription_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers)
1931
+ end
1932
+ page
1933
+ end
1934
+ end
1935
+
1936
+ #
1937
+ # Queries policy events for the resource group level policy assignment.
1938
+ #
1939
+ # @param subscription_id [String] Microsoft Azure subscription ID.
1940
+ # @param resource_group_name [String] Resource group name.
1941
+ # @param policy_assignment_name [String] Policy assignment name.
1942
+ # @param query_options [QueryOptions] Additional parameters for the operation
1943
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1944
+ # will be added to the HTTP request.
1945
+ #
1946
+ # @return [PolicyEventsQueryResults] which provide lazy access to pages of the
1947
+ # response.
1948
+ #
1949
+ def list_query_results_for_resource_group_level_policy_assignment_as_lazy(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
1950
+ response = list_query_results_for_resource_group_level_policy_assignment_async(subscription_id, resource_group_name, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
1951
+ unless response.nil?
1952
+ page = response.body
1953
+ page.next_method = Proc.new do |next_page_link|
1954
+ list_query_results_for_resource_group_level_policy_assignment_next_async(next_page_link, custom_headers:custom_headers)
1955
+ end
1956
+ page
1957
+ end
1958
+ end
1959
+
1960
+ end
1961
+ end