azure_mgmt_policy_insights 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights.rb +46 -0
  4. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/column.rb +68 -0
  5. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  6. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  7. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +55 -0
  8. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +55 -0
  9. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table.rb +88 -0
  10. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_columns.rb +387 -0
  11. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_metadata.rb +47 -0
  12. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +55 -0
  13. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table.rb +88 -0
  14. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_columns.rb +362 -0
  15. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_metadata.rb +47 -0
  16. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  17. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  18. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  19. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  20. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  21. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  22. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_events.rb +507 -0
  23. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  24. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_states.rb +555 -0
  25. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights.rb +41 -0
  26. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  27. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  28. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  29. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
  30. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
  31. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
  32. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  33. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  34. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  35. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  36. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  37. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  38. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  39. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_events.rb +607 -0
  40. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  41. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb +655 -0
  42. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights.rb +46 -0
  43. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  44. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  45. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  46. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +91 -0
  47. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +70 -0
  48. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
  49. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
  50. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
  51. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  52. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  53. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  54. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  55. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  56. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
  57. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary.rb +92 -0
  58. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary_results.rb +76 -0
  59. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  60. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  61. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_events.rb +1107 -0
  62. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  63. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_states.rb +2089 -0
  64. data/lib/2018-04-04/generated/azure_mgmt_policy_insights.rb +46 -0
  65. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  66. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  67. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  68. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +91 -0
  69. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +81 -0
  70. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_event.rb +384 -0
  71. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +82 -0
  72. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_state.rb +361 -0
  73. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  74. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  75. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  76. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +58 -0
  77. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_options.rb +112 -0
  78. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
  79. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary.rb +92 -0
  80. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary_results.rb +76 -0
  81. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  82. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/operations.rb +107 -0
  83. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb +1107 -0
  84. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +135 -0
  85. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb +2089 -0
  86. data/lib/azure_mgmt_policy_insights.rb +9 -0
  87. data/lib/module_definition.rb +7 -0
  88. data/lib/profiles/latest/modules/policyinsights_profile_module.rb +129 -0
  89. data/lib/profiles/latest/policyinsights_latest_profile_client.rb +40 -0
  90. data/lib/profiles/latest/policyinsights_module_definition.rb +8 -0
  91. data/lib/version.rb +7 -0
  92. metadata +210 -0
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::PolicyInsights end
8
+ module Azure::PolicyInsights::Mgmt end
9
+ module Azure::PolicyInsights::Mgmt::V2018_04_04 end
@@ -0,0 +1,107 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::PolicyInsights::Mgmt::V2018_04_04
7
+ #
8
+ # Operations
9
+ #
10
+ class Operations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Operations 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
+ # Lists available operations.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [OperationsListResults] operation results.
31
+ #
32
+ def list(custom_headers:nil)
33
+ response = list_async(custom_headers:custom_headers).value!
34
+ response.body unless response.nil?
35
+ end
36
+
37
+ #
38
+ # Lists available operations.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def list_with_http_info(custom_headers:nil)
46
+ list_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Lists available operations.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def list_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'providers/Microsoft.PolicyInsights/operations'
68
+
69
+ request_url = @base_url || @client.base_url
70
+
71
+ options = {
72
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
73
+ query_params: {'api-version' => @client.api_version},
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ # Deserialize Response
90
+ if status_code == 200
91
+ begin
92
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
93
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::OperationsListResults.mapper()
94
+ result.body = @client.deserialize(result_mapper, parsed_response)
95
+ rescue Exception => e
96
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
97
+ end
98
+ end
99
+
100
+ result
101
+ end
102
+
103
+ promise.execute
104
+ end
105
+
106
+ end
107
+ end
@@ -0,0 +1,1107 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::PolicyInsights::Mgmt::V2018_04_04
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 [PolicyEventsQueryResults] operation results.
33
+ #
34
+ def list_query_results_for_management_group(management_group_name, query_options:nil, custom_headers:nil)
35
+ response = list_query_results_for_management_group_async(management_group_name, query_options:query_options, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
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
+ unless query_options.nil?
77
+ top = query_options.Top
78
+ end
79
+ unless query_options.nil?
80
+ order_by = query_options.OrderBy
81
+ end
82
+ unless query_options.nil?
83
+ select = query_options.Select
84
+ end
85
+ unless query_options.nil?
86
+ from = query_options.From
87
+ end
88
+ unless query_options.nil?
89
+ to = query_options.To
90
+ end
91
+ unless query_options.nil?
92
+ filter = query_options.Filter
93
+ end
94
+ unless query_options.nil?
95
+ apply = query_options.Apply
96
+ end
97
+
98
+ request_headers = {}
99
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
100
+
101
+ # Set Headers
102
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
103
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
104
+ path_template = 'providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
105
+
106
+ request_url = @base_url || @client.base_url
107
+
108
+ options = {
109
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
110
+ path_params: {'policyEventsResource' => policy_events_resource,'managementGroupsNamespace' => management_groups_namespace,'managementGroupName' => management_group_name},
111
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
112
+ headers: request_headers.merge(custom_headers || {}),
113
+ base_url: request_url
114
+ }
115
+ promise = @client.make_request_async(:post, path_template, options)
116
+
117
+ promise = promise.then do |result|
118
+ http_response = result.response
119
+ status_code = http_response.status
120
+ response_content = http_response.body
121
+ unless status_code == 200
122
+ error_model = JSON.load(response_content)
123
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
124
+ end
125
+
126
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
127
+ # Deserialize Response
128
+ if status_code == 200
129
+ begin
130
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
131
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
132
+ result.body = @client.deserialize(result_mapper, parsed_response)
133
+ rescue Exception => e
134
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
135
+ end
136
+ end
137
+
138
+ result
139
+ end
140
+
141
+ promise.execute
142
+ end
143
+
144
+ #
145
+ # Queries policy events for the resources under the subscription.
146
+ #
147
+ # @param subscription_id [String] Microsoft Azure subscription ID.
148
+ # @param query_options [QueryOptions] Additional parameters for the operation
149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
150
+ # will be added to the HTTP request.
151
+ #
152
+ # @return [PolicyEventsQueryResults] operation results.
153
+ #
154
+ def list_query_results_for_subscription(subscription_id, query_options:nil, custom_headers:nil)
155
+ response = list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
156
+ response.body unless response.nil?
157
+ end
158
+
159
+ #
160
+ # Queries policy events for the resources under the subscription.
161
+ #
162
+ # @param subscription_id [String] Microsoft Azure subscription ID.
163
+ # @param query_options [QueryOptions] Additional parameters for the operation
164
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
165
+ # will be added to the HTTP request.
166
+ #
167
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
168
+ #
169
+ def list_query_results_for_subscription_with_http_info(subscription_id, query_options:nil, custom_headers:nil)
170
+ list_query_results_for_subscription_async(subscription_id, query_options:query_options, custom_headers:custom_headers).value!
171
+ end
172
+
173
+ #
174
+ # Queries policy events for the resources under the subscription.
175
+ #
176
+ # @param subscription_id [String] Microsoft Azure subscription ID.
177
+ # @param query_options [QueryOptions] Additional parameters for the operation
178
+ # @param [Hash{String => String}] A hash of custom headers that will be added
179
+ # to the HTTP request.
180
+ #
181
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
182
+ #
183
+ def list_query_results_for_subscription_async(subscription_id, query_options:nil, custom_headers:nil)
184
+ policy_events_resource = 'default'
185
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
186
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
187
+
188
+ top = nil
189
+ order_by = nil
190
+ select = nil
191
+ from = nil
192
+ to = nil
193
+ filter = nil
194
+ apply = nil
195
+ unless query_options.nil?
196
+ top = query_options.Top
197
+ end
198
+ unless query_options.nil?
199
+ order_by = query_options.OrderBy
200
+ end
201
+ unless query_options.nil?
202
+ select = query_options.Select
203
+ end
204
+ unless query_options.nil?
205
+ from = query_options.From
206
+ end
207
+ unless query_options.nil?
208
+ to = query_options.To
209
+ end
210
+ unless query_options.nil?
211
+ filter = query_options.Filter
212
+ end
213
+ unless query_options.nil?
214
+ apply = query_options.Apply
215
+ end
216
+
217
+ request_headers = {}
218
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
219
+
220
+ # Set Headers
221
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
222
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
223
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
224
+
225
+ request_url = @base_url || @client.base_url
226
+
227
+ options = {
228
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
229
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id},
230
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
231
+ headers: request_headers.merge(custom_headers || {}),
232
+ base_url: request_url
233
+ }
234
+ promise = @client.make_request_async(:post, path_template, options)
235
+
236
+ promise = promise.then do |result|
237
+ http_response = result.response
238
+ status_code = http_response.status
239
+ response_content = http_response.body
240
+ unless status_code == 200
241
+ error_model = JSON.load(response_content)
242
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
243
+ end
244
+
245
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
246
+ # Deserialize Response
247
+ if status_code == 200
248
+ begin
249
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
250
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
251
+ result.body = @client.deserialize(result_mapper, parsed_response)
252
+ rescue Exception => e
253
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
254
+ end
255
+ end
256
+
257
+ result
258
+ end
259
+
260
+ promise.execute
261
+ end
262
+
263
+ #
264
+ # Queries policy events for the resources under the resource group.
265
+ #
266
+ # @param subscription_id [String] Microsoft Azure subscription ID.
267
+ # @param resource_group_name [String] Resource group name.
268
+ # @param query_options [QueryOptions] Additional parameters for the operation
269
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
270
+ # will be added to the HTTP request.
271
+ #
272
+ # @return [PolicyEventsQueryResults] operation results.
273
+ #
274
+ def list_query_results_for_resource_group(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
275
+ response = list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
276
+ response.body unless response.nil?
277
+ end
278
+
279
+ #
280
+ # Queries policy events for the resources under the resource group.
281
+ #
282
+ # @param subscription_id [String] Microsoft Azure subscription ID.
283
+ # @param resource_group_name [String] Resource group name.
284
+ # @param query_options [QueryOptions] Additional parameters for the operation
285
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
286
+ # will be added to the HTTP request.
287
+ #
288
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
289
+ #
290
+ def list_query_results_for_resource_group_with_http_info(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
291
+ list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:query_options, custom_headers:custom_headers).value!
292
+ end
293
+
294
+ #
295
+ # Queries policy events for the resources under the resource group.
296
+ #
297
+ # @param subscription_id [String] Microsoft Azure subscription ID.
298
+ # @param resource_group_name [String] Resource group name.
299
+ # @param query_options [QueryOptions] Additional parameters for the operation
300
+ # @param [Hash{String => String}] A hash of custom headers that will be added
301
+ # to the HTTP request.
302
+ #
303
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
304
+ #
305
+ def list_query_results_for_resource_group_async(subscription_id, resource_group_name, query_options:nil, custom_headers:nil)
306
+ policy_events_resource = 'default'
307
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
308
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
309
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
310
+
311
+ top = nil
312
+ order_by = nil
313
+ select = nil
314
+ from = nil
315
+ to = nil
316
+ filter = nil
317
+ apply = nil
318
+ unless query_options.nil?
319
+ top = query_options.Top
320
+ end
321
+ unless query_options.nil?
322
+ order_by = query_options.OrderBy
323
+ end
324
+ unless query_options.nil?
325
+ select = query_options.Select
326
+ end
327
+ unless query_options.nil?
328
+ from = query_options.From
329
+ end
330
+ unless query_options.nil?
331
+ to = query_options.To
332
+ end
333
+ unless query_options.nil?
334
+ filter = query_options.Filter
335
+ end
336
+ unless query_options.nil?
337
+ apply = query_options.Apply
338
+ end
339
+
340
+ request_headers = {}
341
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
342
+
343
+ # Set Headers
344
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
345
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
346
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
347
+
348
+ request_url = @base_url || @client.base_url
349
+
350
+ options = {
351
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
352
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name},
353
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
354
+ headers: request_headers.merge(custom_headers || {}),
355
+ base_url: request_url
356
+ }
357
+ promise = @client.make_request_async(:post, path_template, options)
358
+
359
+ promise = promise.then do |result|
360
+ http_response = result.response
361
+ status_code = http_response.status
362
+ response_content = http_response.body
363
+ unless status_code == 200
364
+ error_model = JSON.load(response_content)
365
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
366
+ end
367
+
368
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
369
+ # Deserialize Response
370
+ if status_code == 200
371
+ begin
372
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
373
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
374
+ result.body = @client.deserialize(result_mapper, parsed_response)
375
+ rescue Exception => e
376
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
377
+ end
378
+ end
379
+
380
+ result
381
+ end
382
+
383
+ promise.execute
384
+ end
385
+
386
+ #
387
+ # Queries policy events for the resource.
388
+ #
389
+ # @param resource_id [String] Resource ID.
390
+ # @param query_options [QueryOptions] Additional parameters for the operation
391
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
392
+ # will be added to the HTTP request.
393
+ #
394
+ # @return [PolicyEventsQueryResults] operation results.
395
+ #
396
+ def list_query_results_for_resource(resource_id, query_options:nil, custom_headers:nil)
397
+ response = list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
398
+ response.body unless response.nil?
399
+ end
400
+
401
+ #
402
+ # Queries policy events for the resource.
403
+ #
404
+ # @param resource_id [String] Resource ID.
405
+ # @param query_options [QueryOptions] Additional parameters for the operation
406
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
407
+ # will be added to the HTTP request.
408
+ #
409
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
410
+ #
411
+ def list_query_results_for_resource_with_http_info(resource_id, query_options:nil, custom_headers:nil)
412
+ list_query_results_for_resource_async(resource_id, query_options:query_options, custom_headers:custom_headers).value!
413
+ end
414
+
415
+ #
416
+ # Queries policy events for the resource.
417
+ #
418
+ # @param resource_id [String] Resource ID.
419
+ # @param query_options [QueryOptions] Additional parameters for the operation
420
+ # @param [Hash{String => String}] A hash of custom headers that will be added
421
+ # to the HTTP request.
422
+ #
423
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
424
+ #
425
+ def list_query_results_for_resource_async(resource_id, query_options:nil, custom_headers:nil)
426
+ policy_events_resource = 'default'
427
+ fail ArgumentError, 'resource_id is nil' if resource_id.nil?
428
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
429
+
430
+ top = nil
431
+ order_by = nil
432
+ select = nil
433
+ from = nil
434
+ to = nil
435
+ filter = nil
436
+ apply = nil
437
+ unless query_options.nil?
438
+ top = query_options.Top
439
+ end
440
+ unless query_options.nil?
441
+ order_by = query_options.OrderBy
442
+ end
443
+ unless query_options.nil?
444
+ select = query_options.Select
445
+ end
446
+ unless query_options.nil?
447
+ from = query_options.From
448
+ end
449
+ unless query_options.nil?
450
+ to = query_options.To
451
+ end
452
+ unless query_options.nil?
453
+ filter = query_options.Filter
454
+ end
455
+ unless query_options.nil?
456
+ apply = query_options.Apply
457
+ end
458
+
459
+ request_headers = {}
460
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
461
+
462
+ # Set Headers
463
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
464
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
465
+ path_template = '{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
466
+
467
+ request_url = @base_url || @client.base_url
468
+
469
+ options = {
470
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
471
+ path_params: {'policyEventsResource' => policy_events_resource},
472
+ skip_encoding_path_params: {'resourceId' => resource_id},
473
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
474
+ headers: request_headers.merge(custom_headers || {}),
475
+ base_url: request_url
476
+ }
477
+ promise = @client.make_request_async(:post, path_template, options)
478
+
479
+ promise = promise.then do |result|
480
+ http_response = result.response
481
+ status_code = http_response.status
482
+ response_content = http_response.body
483
+ unless status_code == 200
484
+ error_model = JSON.load(response_content)
485
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
486
+ end
487
+
488
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
489
+ # Deserialize Response
490
+ if status_code == 200
491
+ begin
492
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
493
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
494
+ result.body = @client.deserialize(result_mapper, parsed_response)
495
+ rescue Exception => e
496
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
497
+ end
498
+ end
499
+
500
+ result
501
+ end
502
+
503
+ promise.execute
504
+ end
505
+
506
+ #
507
+ # Queries policy events for the subscription level policy set definition.
508
+ #
509
+ # @param subscription_id [String] Microsoft Azure subscription ID.
510
+ # @param policy_set_definition_name [String] Policy set definition name.
511
+ # @param query_options [QueryOptions] Additional parameters for the operation
512
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
513
+ # will be added to the HTTP request.
514
+ #
515
+ # @return [PolicyEventsQueryResults] operation results.
516
+ #
517
+ def list_query_results_for_policy_set_definition(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
518
+ response = list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
519
+ response.body unless response.nil?
520
+ end
521
+
522
+ #
523
+ # Queries policy events for the subscription level policy set definition.
524
+ #
525
+ # @param subscription_id [String] Microsoft Azure subscription ID.
526
+ # @param policy_set_definition_name [String] Policy set definition name.
527
+ # @param query_options [QueryOptions] Additional parameters for the operation
528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
529
+ # will be added to the HTTP request.
530
+ #
531
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
532
+ #
533
+ def list_query_results_for_policy_set_definition_with_http_info(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
534
+ list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:query_options, custom_headers:custom_headers).value!
535
+ end
536
+
537
+ #
538
+ # Queries policy events for the subscription level policy set definition.
539
+ #
540
+ # @param subscription_id [String] Microsoft Azure subscription ID.
541
+ # @param policy_set_definition_name [String] Policy set definition name.
542
+ # @param query_options [QueryOptions] Additional parameters for the operation
543
+ # @param [Hash{String => String}] A hash of custom headers that will be added
544
+ # to the HTTP request.
545
+ #
546
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
547
+ #
548
+ def list_query_results_for_policy_set_definition_async(subscription_id, policy_set_definition_name, query_options:nil, custom_headers:nil)
549
+ policy_events_resource = 'default'
550
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
551
+ authorization_namespace = 'Microsoft.Authorization'
552
+ fail ArgumentError, 'policy_set_definition_name is nil' if policy_set_definition_name.nil?
553
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
554
+
555
+ top = nil
556
+ order_by = nil
557
+ select = nil
558
+ from = nil
559
+ to = nil
560
+ filter = nil
561
+ apply = nil
562
+ unless query_options.nil?
563
+ top = query_options.Top
564
+ end
565
+ unless query_options.nil?
566
+ order_by = query_options.OrderBy
567
+ end
568
+ unless query_options.nil?
569
+ select = query_options.Select
570
+ end
571
+ unless query_options.nil?
572
+ from = query_options.From
573
+ end
574
+ unless query_options.nil?
575
+ to = query_options.To
576
+ end
577
+ unless query_options.nil?
578
+ filter = query_options.Filter
579
+ end
580
+ unless query_options.nil?
581
+ apply = query_options.Apply
582
+ end
583
+
584
+ request_headers = {}
585
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
586
+
587
+ # Set Headers
588
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
589
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
590
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
591
+
592
+ request_url = @base_url || @client.base_url
593
+
594
+ options = {
595
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
596
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policySetDefinitionName' => policy_set_definition_name},
597
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
598
+ headers: request_headers.merge(custom_headers || {}),
599
+ base_url: request_url
600
+ }
601
+ promise = @client.make_request_async(:post, path_template, options)
602
+
603
+ promise = promise.then do |result|
604
+ http_response = result.response
605
+ status_code = http_response.status
606
+ response_content = http_response.body
607
+ unless status_code == 200
608
+ error_model = JSON.load(response_content)
609
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
610
+ end
611
+
612
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
613
+ # Deserialize Response
614
+ if status_code == 200
615
+ begin
616
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
617
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
618
+ result.body = @client.deserialize(result_mapper, parsed_response)
619
+ rescue Exception => e
620
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
621
+ end
622
+ end
623
+
624
+ result
625
+ end
626
+
627
+ promise.execute
628
+ end
629
+
630
+ #
631
+ # Queries policy events for the subscription level policy definition.
632
+ #
633
+ # @param subscription_id [String] Microsoft Azure subscription ID.
634
+ # @param policy_definition_name [String] Policy definition name.
635
+ # @param query_options [QueryOptions] Additional parameters for the operation
636
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
637
+ # will be added to the HTTP request.
638
+ #
639
+ # @return [PolicyEventsQueryResults] operation results.
640
+ #
641
+ def list_query_results_for_policy_definition(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
642
+ response = list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
643
+ response.body unless response.nil?
644
+ end
645
+
646
+ #
647
+ # Queries policy events for the subscription level policy definition.
648
+ #
649
+ # @param subscription_id [String] Microsoft Azure subscription ID.
650
+ # @param policy_definition_name [String] Policy definition name.
651
+ # @param query_options [QueryOptions] Additional parameters for the operation
652
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
653
+ # will be added to the HTTP request.
654
+ #
655
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
656
+ #
657
+ def list_query_results_for_policy_definition_with_http_info(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
658
+ list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:query_options, custom_headers:custom_headers).value!
659
+ end
660
+
661
+ #
662
+ # Queries policy events for the subscription level policy definition.
663
+ #
664
+ # @param subscription_id [String] Microsoft Azure subscription ID.
665
+ # @param policy_definition_name [String] Policy definition name.
666
+ # @param query_options [QueryOptions] Additional parameters for the operation
667
+ # @param [Hash{String => String}] A hash of custom headers that will be added
668
+ # to the HTTP request.
669
+ #
670
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
671
+ #
672
+ def list_query_results_for_policy_definition_async(subscription_id, policy_definition_name, query_options:nil, custom_headers:nil)
673
+ policy_events_resource = 'default'
674
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
675
+ authorization_namespace = 'Microsoft.Authorization'
676
+ fail ArgumentError, 'policy_definition_name is nil' if policy_definition_name.nil?
677
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
678
+
679
+ top = nil
680
+ order_by = nil
681
+ select = nil
682
+ from = nil
683
+ to = nil
684
+ filter = nil
685
+ apply = nil
686
+ unless query_options.nil?
687
+ top = query_options.Top
688
+ end
689
+ unless query_options.nil?
690
+ order_by = query_options.OrderBy
691
+ end
692
+ unless query_options.nil?
693
+ select = query_options.Select
694
+ end
695
+ unless query_options.nil?
696
+ from = query_options.From
697
+ end
698
+ unless query_options.nil?
699
+ to = query_options.To
700
+ end
701
+ unless query_options.nil?
702
+ filter = query_options.Filter
703
+ end
704
+ unless query_options.nil?
705
+ apply = query_options.Apply
706
+ end
707
+
708
+ request_headers = {}
709
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
710
+
711
+ # Set Headers
712
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
713
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
714
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
715
+
716
+ request_url = @base_url || @client.base_url
717
+
718
+ options = {
719
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
720
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyDefinitionName' => policy_definition_name},
721
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
722
+ headers: request_headers.merge(custom_headers || {}),
723
+ base_url: request_url
724
+ }
725
+ promise = @client.make_request_async(:post, path_template, options)
726
+
727
+ promise = promise.then do |result|
728
+ http_response = result.response
729
+ status_code = http_response.status
730
+ response_content = http_response.body
731
+ unless status_code == 200
732
+ error_model = JSON.load(response_content)
733
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
734
+ end
735
+
736
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
737
+ # Deserialize Response
738
+ if status_code == 200
739
+ begin
740
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
741
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
742
+ result.body = @client.deserialize(result_mapper, parsed_response)
743
+ rescue Exception => e
744
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
745
+ end
746
+ end
747
+
748
+ result
749
+ end
750
+
751
+ promise.execute
752
+ end
753
+
754
+ #
755
+ # Queries policy events for the subscription level policy assignment.
756
+ #
757
+ # @param subscription_id [String] Microsoft Azure subscription ID.
758
+ # @param policy_assignment_name [String] Policy assignment name.
759
+ # @param query_options [QueryOptions] Additional parameters for the operation
760
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
761
+ # will be added to the HTTP request.
762
+ #
763
+ # @return [PolicyEventsQueryResults] operation results.
764
+ #
765
+ def list_query_results_for_subscription_level_policy_assignment(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
766
+ response = list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
767
+ response.body unless response.nil?
768
+ end
769
+
770
+ #
771
+ # Queries policy events for the subscription level policy assignment.
772
+ #
773
+ # @param subscription_id [String] Microsoft Azure subscription ID.
774
+ # @param policy_assignment_name [String] Policy assignment name.
775
+ # @param query_options [QueryOptions] Additional parameters for the operation
776
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
777
+ # will be added to the HTTP request.
778
+ #
779
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
780
+ #
781
+ def list_query_results_for_subscription_level_policy_assignment_with_http_info(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
782
+ list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:query_options, custom_headers:custom_headers).value!
783
+ end
784
+
785
+ #
786
+ # Queries policy events for the subscription level policy assignment.
787
+ #
788
+ # @param subscription_id [String] Microsoft Azure subscription ID.
789
+ # @param policy_assignment_name [String] Policy assignment name.
790
+ # @param query_options [QueryOptions] Additional parameters for the operation
791
+ # @param [Hash{String => String}] A hash of custom headers that will be added
792
+ # to the HTTP request.
793
+ #
794
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
795
+ #
796
+ def list_query_results_for_subscription_level_policy_assignment_async(subscription_id, policy_assignment_name, query_options:nil, custom_headers:nil)
797
+ policy_events_resource = 'default'
798
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
799
+ authorization_namespace = 'Microsoft.Authorization'
800
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
801
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
802
+
803
+ top = nil
804
+ order_by = nil
805
+ select = nil
806
+ from = nil
807
+ to = nil
808
+ filter = nil
809
+ apply = nil
810
+ unless query_options.nil?
811
+ top = query_options.Top
812
+ end
813
+ unless query_options.nil?
814
+ order_by = query_options.OrderBy
815
+ end
816
+ unless query_options.nil?
817
+ select = query_options.Select
818
+ end
819
+ unless query_options.nil?
820
+ from = query_options.From
821
+ end
822
+ unless query_options.nil?
823
+ to = query_options.To
824
+ end
825
+ unless query_options.nil?
826
+ filter = query_options.Filter
827
+ end
828
+ unless query_options.nil?
829
+ apply = query_options.Apply
830
+ end
831
+
832
+ request_headers = {}
833
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
834
+
835
+ # Set Headers
836
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
837
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
838
+ path_template = 'subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
839
+
840
+ request_url = @base_url || @client.base_url
841
+
842
+ options = {
843
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
844
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
845
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
846
+ headers: request_headers.merge(custom_headers || {}),
847
+ base_url: request_url
848
+ }
849
+ promise = @client.make_request_async(:post, path_template, options)
850
+
851
+ promise = promise.then do |result|
852
+ http_response = result.response
853
+ status_code = http_response.status
854
+ response_content = http_response.body
855
+ unless status_code == 200
856
+ error_model = JSON.load(response_content)
857
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
858
+ end
859
+
860
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
861
+ # Deserialize Response
862
+ if status_code == 200
863
+ begin
864
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
865
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
866
+ result.body = @client.deserialize(result_mapper, parsed_response)
867
+ rescue Exception => e
868
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
869
+ end
870
+ end
871
+
872
+ result
873
+ end
874
+
875
+ promise.execute
876
+ end
877
+
878
+ #
879
+ # Queries policy events for the resource group level policy assignment.
880
+ #
881
+ # @param subscription_id [String] Microsoft Azure subscription ID.
882
+ # @param resource_group_name [String] Resource group name.
883
+ # @param policy_assignment_name [String] Policy assignment name.
884
+ # @param query_options [QueryOptions] Additional parameters for the operation
885
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
886
+ # will be added to the HTTP request.
887
+ #
888
+ # @return [PolicyEventsQueryResults] operation results.
889
+ #
890
+ def list_query_results_for_resource_group_level_policy_assignment(subscription_id, resource_group_name, policy_assignment_name, query_options:nil, custom_headers:nil)
891
+ 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!
892
+ response.body unless response.nil?
893
+ end
894
+
895
+ #
896
+ # Queries policy events for the resource group level policy assignment.
897
+ #
898
+ # @param subscription_id [String] Microsoft Azure subscription ID.
899
+ # @param resource_group_name [String] Resource group name.
900
+ # @param policy_assignment_name [String] Policy assignment name.
901
+ # @param query_options [QueryOptions] Additional parameters for the operation
902
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
903
+ # will be added to the HTTP request.
904
+ #
905
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
906
+ #
907
+ 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)
908
+ 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!
909
+ end
910
+
911
+ #
912
+ # Queries policy events for the resource group level policy assignment.
913
+ #
914
+ # @param subscription_id [String] Microsoft Azure subscription ID.
915
+ # @param resource_group_name [String] Resource group name.
916
+ # @param policy_assignment_name [String] Policy assignment name.
917
+ # @param query_options [QueryOptions] Additional parameters for the operation
918
+ # @param [Hash{String => String}] A hash of custom headers that will be added
919
+ # to the HTTP request.
920
+ #
921
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
922
+ #
923
+ 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)
924
+ policy_events_resource = 'default'
925
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
926
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
927
+ authorization_namespace = 'Microsoft.Authorization'
928
+ fail ArgumentError, 'policy_assignment_name is nil' if policy_assignment_name.nil?
929
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
930
+
931
+ top = nil
932
+ order_by = nil
933
+ select = nil
934
+ from = nil
935
+ to = nil
936
+ filter = nil
937
+ apply = nil
938
+ unless query_options.nil?
939
+ top = query_options.Top
940
+ end
941
+ unless query_options.nil?
942
+ order_by = query_options.OrderBy
943
+ end
944
+ unless query_options.nil?
945
+ select = query_options.Select
946
+ end
947
+ unless query_options.nil?
948
+ from = query_options.From
949
+ end
950
+ unless query_options.nil?
951
+ to = query_options.To
952
+ end
953
+ unless query_options.nil?
954
+ filter = query_options.Filter
955
+ end
956
+ unless query_options.nil?
957
+ apply = query_options.Apply
958
+ end
959
+
960
+ request_headers = {}
961
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
962
+
963
+ # Set Headers
964
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
965
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
966
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'
967
+
968
+ request_url = @base_url || @client.base_url
969
+
970
+ options = {
971
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
972
+ path_params: {'policyEventsResource' => policy_events_resource,'subscriptionId' => subscription_id,'resourceGroupName' => resource_group_name,'authorizationNamespace' => authorization_namespace,'policyAssignmentName' => policy_assignment_name},
973
+ query_params: {'api-version' => @client.api_version,'$top' => top,'$orderby' => order_by,'$select' => select,'$from' => from,'$to' => to,'$filter' => filter,'$apply' => apply},
974
+ headers: request_headers.merge(custom_headers || {}),
975
+ base_url: request_url
976
+ }
977
+ promise = @client.make_request_async(:post, path_template, options)
978
+
979
+ promise = promise.then do |result|
980
+ http_response = result.response
981
+ status_code = http_response.status
982
+ response_content = http_response.body
983
+ unless status_code == 200
984
+ error_model = JSON.load(response_content)
985
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
986
+ end
987
+
988
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
989
+ # Deserialize Response
990
+ if status_code == 200
991
+ begin
992
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
993
+ result_mapper = Azure::PolicyInsights::Mgmt::V2018_04_04::Models::PolicyEventsQueryResults.mapper()
994
+ result.body = @client.deserialize(result_mapper, parsed_response)
995
+ rescue Exception => e
996
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
997
+ end
998
+ end
999
+
1000
+ result
1001
+ end
1002
+
1003
+ promise.execute
1004
+ end
1005
+
1006
+ #
1007
+ # Gets OData metadata XML document.
1008
+ #
1009
+ # @param scope [String] A valid scope, i.e. management group, subscription,
1010
+ # resource group, or resource ID. Scope used has no effect on metadata
1011
+ # returned.
1012
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1013
+ # will be added to the HTTP request.
1014
+ #
1015
+ # @return [String] operation results.
1016
+ #
1017
+ def get_metadata(scope, custom_headers:nil)
1018
+ response = get_metadata_async(scope, custom_headers:custom_headers).value!
1019
+ response.body unless response.nil?
1020
+ end
1021
+
1022
+ #
1023
+ # Gets OData metadata XML document.
1024
+ #
1025
+ # @param scope [String] A valid scope, i.e. management group, subscription,
1026
+ # resource group, or resource ID. Scope used has no effect on metadata
1027
+ # returned.
1028
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1029
+ # will be added to the HTTP request.
1030
+ #
1031
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1032
+ #
1033
+ def get_metadata_with_http_info(scope, custom_headers:nil)
1034
+ get_metadata_async(scope, custom_headers:custom_headers).value!
1035
+ end
1036
+
1037
+ #
1038
+ # Gets OData metadata XML document.
1039
+ #
1040
+ # @param scope [String] A valid scope, i.e. management group, subscription,
1041
+ # resource group, or resource ID. Scope used has no effect on metadata
1042
+ # returned.
1043
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1044
+ # to the HTTP request.
1045
+ #
1046
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1047
+ #
1048
+ def get_metadata_async(scope, custom_headers:nil)
1049
+ fail ArgumentError, 'scope is nil' if scope.nil?
1050
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1051
+
1052
+
1053
+ request_headers = {}
1054
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1055
+
1056
+ # Set Headers
1057
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1058
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1059
+ path_template = '{scope}/providers/Microsoft.PolicyInsights/policyEvents/$metadata'
1060
+
1061
+ request_url = @base_url || @client.base_url
1062
+
1063
+ options = {
1064
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1065
+ skip_encoding_path_params: {'scope' => scope},
1066
+ query_params: {'api-version' => @client.api_version},
1067
+ headers: request_headers.merge(custom_headers || {}),
1068
+ base_url: request_url
1069
+ }
1070
+ promise = @client.make_request_async(:get, path_template, options)
1071
+
1072
+ promise = promise.then do |result|
1073
+ http_response = result.response
1074
+ status_code = http_response.status
1075
+ response_content = http_response.body
1076
+ unless status_code == 200
1077
+ error_model = JSON.load(response_content)
1078
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1079
+ end
1080
+
1081
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1082
+ # Deserialize Response
1083
+ if status_code == 200
1084
+ begin
1085
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1086
+ result_mapper = {
1087
+ client_side_validation: true,
1088
+ required: false,
1089
+ serialized_name: 'parsed_response',
1090
+ type: {
1091
+ name: 'String'
1092
+ }
1093
+ }
1094
+ result.body = @client.deserialize(result_mapper, parsed_response)
1095
+ rescue Exception => e
1096
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1097
+ end
1098
+ end
1099
+
1100
+ result
1101
+ end
1102
+
1103
+ promise.execute
1104
+ end
1105
+
1106
+ end
1107
+ end