azure_mgmt_monitor 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/azure_mgmt_monitor.rb +5 -0
  4. data/lib/generated/azure_mgmt_monitor.rb +96 -0
  5. data/lib/generated/azure_mgmt_monitor/action_groups.rb +579 -0
  6. data/lib/generated/azure_mgmt_monitor/activity_log_alerts.rb +593 -0
  7. data/lib/generated/azure_mgmt_monitor/alert_rule_incidents.rb +211 -0
  8. data/lib/generated/azure_mgmt_monitor/alert_rules.rb +510 -0
  9. data/lib/generated/azure_mgmt_monitor/autoscale_settings.rb +618 -0
  10. data/lib/generated/azure_mgmt_monitor/log_profiles.rb +477 -0
  11. data/lib/generated/azure_mgmt_monitor/models/action_group_list.rb +63 -0
  12. data/lib/generated/azure_mgmt_monitor/models/action_group_resource.rb +164 -0
  13. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_group.rb +65 -0
  14. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_list.rb +54 -0
  15. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_all_of_condition.rb +55 -0
  16. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_leaf_condition.rb +61 -0
  17. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_list.rb +64 -0
  18. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_patch_body.rb +65 -0
  19. data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb +147 -0
  20. data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource.rb +159 -0
  21. data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_collection.rb +54 -0
  22. data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_patch.rb +131 -0
  23. data/lib/generated/azure_mgmt_monitor/models/autoscale_notification.rb +78 -0
  24. data/lib/generated/azure_mgmt_monitor/models/autoscale_profile.rb +101 -0
  25. data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource.rb +155 -0
  26. data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_collection.rb +95 -0
  27. data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_patch.rb +127 -0
  28. data/lib/generated/azure_mgmt_monitor/models/comparison_operation_type.rb +20 -0
  29. data/lib/generated/azure_mgmt_monitor/models/condition_operator.rb +18 -0
  30. data/lib/generated/azure_mgmt_monitor/models/email_notification.rb +75 -0
  31. data/lib/generated/azure_mgmt_monitor/models/email_receiver.rb +69 -0
  32. data/lib/generated/azure_mgmt_monitor/models/enable_request.rb +45 -0
  33. data/lib/generated/azure_mgmt_monitor/models/error_response.rb +55 -0
  34. data/lib/generated/azure_mgmt_monitor/models/incident.rb +93 -0
  35. data/lib/generated/azure_mgmt_monitor/models/incident_list_result.rb +53 -0
  36. data/lib/generated/azure_mgmt_monitor/models/location_threshold_rule_condition.rb +85 -0
  37. data/lib/generated/azure_mgmt_monitor/models/log_profile_collection.rb +53 -0
  38. data/lib/generated/azure_mgmt_monitor/models/log_profile_resource.rb +154 -0
  39. data/lib/generated/azure_mgmt_monitor/models/log_profile_resource_patch.rb +126 -0
  40. data/lib/generated/azure_mgmt_monitor/models/log_settings.rb +70 -0
  41. data/lib/generated/azure_mgmt_monitor/models/management_event_aggregation_condition.rb +70 -0
  42. data/lib/generated/azure_mgmt_monitor/models/management_event_rule_condition.rb +73 -0
  43. data/lib/generated/azure_mgmt_monitor/models/metric_settings.rb +67 -0
  44. data/lib/generated/azure_mgmt_monitor/models/metric_statistic_type.rb +18 -0
  45. data/lib/generated/azure_mgmt_monitor/models/metric_trigger.rb +134 -0
  46. data/lib/generated/azure_mgmt_monitor/models/receiver_status.rb +17 -0
  47. data/lib/generated/azure_mgmt_monitor/models/recurrence.rb +62 -0
  48. data/lib/generated/azure_mgmt_monitor/models/recurrence_frequency.rb +22 -0
  49. data/lib/generated/azure_mgmt_monitor/models/recurrent_schedule.rb +139 -0
  50. data/lib/generated/azure_mgmt_monitor/models/retention_policy.rb +60 -0
  51. data/lib/generated/azure_mgmt_monitor/models/rule_action.rb +48 -0
  52. data/lib/generated/azure_mgmt_monitor/models/rule_condition.rb +63 -0
  53. data/lib/generated/azure_mgmt_monitor/models/rule_data_source.rb +58 -0
  54. data/lib/generated/azure_mgmt_monitor/models/rule_email_action.rb +80 -0
  55. data/lib/generated/azure_mgmt_monitor/models/rule_management_event_claims_data_source.rb +45 -0
  56. data/lib/generated/azure_mgmt_monitor/models/rule_management_event_data_source.rb +150 -0
  57. data/lib/generated/azure_mgmt_monitor/models/rule_metric_data_source.rb +68 -0
  58. data/lib/generated/azure_mgmt_monitor/models/rule_webhook_action.rb +80 -0
  59. data/lib/generated/azure_mgmt_monitor/models/scale_action.rb +86 -0
  60. data/lib/generated/azure_mgmt_monitor/models/scale_capacity.rb +69 -0
  61. data/lib/generated/azure_mgmt_monitor/models/scale_direction.rb +17 -0
  62. data/lib/generated/azure_mgmt_monitor/models/scale_rule.rb +57 -0
  63. data/lib/generated/azure_mgmt_monitor/models/scale_type.rb +17 -0
  64. data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb +163 -0
  65. data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb +135 -0
  66. data/lib/generated/azure_mgmt_monitor/models/sms_receiver.rb +79 -0
  67. data/lib/generated/azure_mgmt_monitor/models/threshold_rule_condition.rb +108 -0
  68. data/lib/generated/azure_mgmt_monitor/models/time_aggregation_operator.rb +19 -0
  69. data/lib/generated/azure_mgmt_monitor/models/time_aggregation_type.rb +19 -0
  70. data/lib/generated/azure_mgmt_monitor/models/time_window.rb +104 -0
  71. data/lib/generated/azure_mgmt_monitor/models/webhook_notification.rb +63 -0
  72. data/lib/generated/azure_mgmt_monitor/models/webhook_receiver.rb +56 -0
  73. data/lib/generated/azure_mgmt_monitor/module_definition.rb +8 -0
  74. data/lib/generated/azure_mgmt_monitor/monitor_management_client.rb +150 -0
  75. data/lib/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb +330 -0
  76. data/lib/generated/azure_mgmt_monitor/version.rb +8 -0
  77. metadata +188 -0
@@ -0,0 +1,593 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Monitor
7
+ #
8
+ # Monitor Management Client
9
+ #
10
+ class ActivityLogAlerts
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ActivityLogAlerts class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [MonitorManagementClient] reference to the MonitorManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create a new activity log alert or update an existing one.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param activity_log_alert_name [String] The name of the activity log alert.
29
+ # @param activity_log_alert [ActivityLogAlertResource] The activity log alert
30
+ # to create or use for the update.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [ActivityLogAlertResource] operation results.
35
+ #
36
+ def create_or_update(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers = nil)
37
+ response = create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Create a new activity log alert or update an existing one.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group.
45
+ # @param activity_log_alert_name [String] The name of the activity log alert.
46
+ # @param activity_log_alert [ActivityLogAlertResource] The activity log alert
47
+ # to create or use for the update.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def create_or_update_with_http_info(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers = nil)
54
+ create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Create a new activity log alert or update an existing one.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group.
61
+ # @param activity_log_alert_name [String] The name of the activity log alert.
62
+ # @param activity_log_alert [ActivityLogAlertResource] The activity log alert
63
+ # to create or use for the update.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert, custom_headers = nil)
70
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
71
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
72
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
73
+ api_version = '2017-04-01'
74
+ fail ArgumentError, 'activity_log_alert is nil' if activity_log_alert.nil?
75
+
76
+
77
+ request_headers = {}
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+
83
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
84
+
85
+ # Serialize Request
86
+ request_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertResource.mapper()
87
+ request_content = @client.serialize(request_mapper, activity_log_alert)
88
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
89
+
90
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'
91
+
92
+ request_url = @base_url || @client.base_url
93
+
94
+ options = {
95
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
96
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
97
+ query_params: {'api-version' => api_version},
98
+ body: request_content,
99
+ headers: request_headers.merge(custom_headers || {}),
100
+ base_url: request_url
101
+ }
102
+ promise = @client.make_request_async(:put, path_template, options)
103
+
104
+ promise = promise.then do |result|
105
+ http_response = result.response
106
+ status_code = http_response.status
107
+ response_content = http_response.body
108
+ unless status_code == 200 || status_code == 201
109
+ error_model = JSON.load(response_content)
110
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
111
+ end
112
+
113
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
114
+ # Deserialize Response
115
+ if status_code == 200
116
+ begin
117
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
118
+ result_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertResource.mapper()
119
+ result.body = @client.deserialize(result_mapper, parsed_response)
120
+ rescue Exception => e
121
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
122
+ end
123
+ end
124
+ # Deserialize Response
125
+ if status_code == 201
126
+ begin
127
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
128
+ result_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertResource.mapper()
129
+ result.body = @client.deserialize(result_mapper, parsed_response)
130
+ rescue Exception => e
131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
132
+ end
133
+ end
134
+
135
+ result
136
+ end
137
+
138
+ promise.execute
139
+ end
140
+
141
+ #
142
+ # Get an activity log alert.
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group.
145
+ # @param activity_log_alert_name [String] The name of the activity log alert.
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [ActivityLogAlertResource] operation results.
150
+ #
151
+ def get(resource_group_name, activity_log_alert_name, custom_headers = nil)
152
+ response = get_async(resource_group_name, activity_log_alert_name, custom_headers).value!
153
+ response.body unless response.nil?
154
+ end
155
+
156
+ #
157
+ # Get an activity log alert.
158
+ #
159
+ # @param resource_group_name [String] The name of the resource group.
160
+ # @param activity_log_alert_name [String] The name of the activity log alert.
161
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
162
+ # will be added to the HTTP request.
163
+ #
164
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
165
+ #
166
+ def get_with_http_info(resource_group_name, activity_log_alert_name, custom_headers = nil)
167
+ get_async(resource_group_name, activity_log_alert_name, custom_headers).value!
168
+ end
169
+
170
+ #
171
+ # Get an activity log alert.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group.
174
+ # @param activity_log_alert_name [String] The name of the activity log alert.
175
+ # @param [Hash{String => String}] A hash of custom headers that will be added
176
+ # to the HTTP request.
177
+ #
178
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
179
+ #
180
+ def get_async(resource_group_name, activity_log_alert_name, custom_headers = nil)
181
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
182
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
183
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
184
+ api_version = '2017-04-01'
185
+
186
+
187
+ request_headers = {}
188
+
189
+ # Set Headers
190
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
191
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
192
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'
193
+
194
+ request_url = @base_url || @client.base_url
195
+
196
+ options = {
197
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
198
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
199
+ query_params: {'api-version' => api_version},
200
+ headers: request_headers.merge(custom_headers || {}),
201
+ base_url: request_url
202
+ }
203
+ promise = @client.make_request_async(:get, path_template, options)
204
+
205
+ promise = promise.then do |result|
206
+ http_response = result.response
207
+ status_code = http_response.status
208
+ response_content = http_response.body
209
+ unless status_code == 200
210
+ error_model = JSON.load(response_content)
211
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
212
+ end
213
+
214
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
215
+ # Deserialize Response
216
+ if status_code == 200
217
+ begin
218
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
219
+ result_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertResource.mapper()
220
+ result.body = @client.deserialize(result_mapper, parsed_response)
221
+ rescue Exception => e
222
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
223
+ end
224
+ end
225
+
226
+ result
227
+ end
228
+
229
+ promise.execute
230
+ end
231
+
232
+ #
233
+ # Delete an activity log alert.
234
+ #
235
+ # @param resource_group_name [String] The name of the resource group.
236
+ # @param activity_log_alert_name [String] The name of the activity log alert.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ #
241
+ def delete(resource_group_name, activity_log_alert_name, custom_headers = nil)
242
+ response = delete_async(resource_group_name, activity_log_alert_name, custom_headers).value!
243
+ nil
244
+ end
245
+
246
+ #
247
+ # Delete an activity log alert.
248
+ #
249
+ # @param resource_group_name [String] The name of the resource group.
250
+ # @param activity_log_alert_name [String] The name of the activity log alert.
251
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
252
+ # will be added to the HTTP request.
253
+ #
254
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
255
+ #
256
+ def delete_with_http_info(resource_group_name, activity_log_alert_name, custom_headers = nil)
257
+ delete_async(resource_group_name, activity_log_alert_name, custom_headers).value!
258
+ end
259
+
260
+ #
261
+ # Delete an activity log alert.
262
+ #
263
+ # @param resource_group_name [String] The name of the resource group.
264
+ # @param activity_log_alert_name [String] The name of the activity log alert.
265
+ # @param [Hash{String => String}] A hash of custom headers that will be added
266
+ # to the HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
269
+ #
270
+ def delete_async(resource_group_name, activity_log_alert_name, custom_headers = nil)
271
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
272
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
273
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
274
+ api_version = '2017-04-01'
275
+
276
+
277
+ request_headers = {}
278
+
279
+ # Set Headers
280
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
281
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
282
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'
283
+
284
+ request_url = @base_url || @client.base_url
285
+
286
+ options = {
287
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
288
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
289
+ query_params: {'api-version' => api_version},
290
+ headers: request_headers.merge(custom_headers || {}),
291
+ base_url: request_url
292
+ }
293
+ promise = @client.make_request_async(:delete, path_template, options)
294
+
295
+ promise = promise.then do |result|
296
+ http_response = result.response
297
+ status_code = http_response.status
298
+ response_content = http_response.body
299
+ unless status_code == 200 || status_code == 204
300
+ error_model = JSON.load(response_content)
301
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
302
+ end
303
+
304
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
305
+
306
+ result
307
+ end
308
+
309
+ promise.execute
310
+ end
311
+
312
+ #
313
+ # Updates an existing ActivityLogAlertResource's tags. To update other fields
314
+ # use the CreateOrUpdate method.
315
+ #
316
+ # @param resource_group_name [String] The name of the resource group.
317
+ # @param activity_log_alert_name [String] The name of the activity log alert.
318
+ # @param activity_log_alert_patch [ActivityLogAlertPatchBody] Parameters
319
+ # supplied to the operation.
320
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
321
+ # will be added to the HTTP request.
322
+ #
323
+ # @return [ActivityLogAlertResource] operation results.
324
+ #
325
+ def update(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers = nil)
326
+ response = update_async(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers).value!
327
+ response.body unless response.nil?
328
+ end
329
+
330
+ #
331
+ # Updates an existing ActivityLogAlertResource's tags. To update other fields
332
+ # use the CreateOrUpdate method.
333
+ #
334
+ # @param resource_group_name [String] The name of the resource group.
335
+ # @param activity_log_alert_name [String] The name of the activity log alert.
336
+ # @param activity_log_alert_patch [ActivityLogAlertPatchBody] Parameters
337
+ # supplied to the operation.
338
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
339
+ # will be added to the HTTP request.
340
+ #
341
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
342
+ #
343
+ def update_with_http_info(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers = nil)
344
+ update_async(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers).value!
345
+ end
346
+
347
+ #
348
+ # Updates an existing ActivityLogAlertResource's tags. To update other fields
349
+ # use the CreateOrUpdate method.
350
+ #
351
+ # @param resource_group_name [String] The name of the resource group.
352
+ # @param activity_log_alert_name [String] The name of the activity log alert.
353
+ # @param activity_log_alert_patch [ActivityLogAlertPatchBody] Parameters
354
+ # supplied to the operation.
355
+ # @param [Hash{String => String}] A hash of custom headers that will be added
356
+ # to the HTTP request.
357
+ #
358
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
359
+ #
360
+ def update_async(resource_group_name, activity_log_alert_name, activity_log_alert_patch, custom_headers = nil)
361
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
362
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
363
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
364
+ api_version = '2017-04-01'
365
+ fail ArgumentError, 'activity_log_alert_patch is nil' if activity_log_alert_patch.nil?
366
+
367
+
368
+ request_headers = {}
369
+
370
+ # Set Headers
371
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
372
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
373
+
374
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
375
+
376
+ # Serialize Request
377
+ request_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertPatchBody.mapper()
378
+ request_content = @client.serialize(request_mapper, activity_log_alert_patch)
379
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
380
+
381
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}'
382
+
383
+ request_url = @base_url || @client.base_url
384
+
385
+ options = {
386
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
387
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
388
+ query_params: {'api-version' => api_version},
389
+ body: request_content,
390
+ headers: request_headers.merge(custom_headers || {}),
391
+ base_url: request_url
392
+ }
393
+ promise = @client.make_request_async(:patch, path_template, options)
394
+
395
+ promise = promise.then do |result|
396
+ http_response = result.response
397
+ status_code = http_response.status
398
+ response_content = http_response.body
399
+ unless status_code == 200
400
+ error_model = JSON.load(response_content)
401
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
402
+ end
403
+
404
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
405
+ # Deserialize Response
406
+ if status_code == 200
407
+ begin
408
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
409
+ result_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertResource.mapper()
410
+ result.body = @client.deserialize(result_mapper, parsed_response)
411
+ rescue Exception => e
412
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
413
+ end
414
+ end
415
+
416
+ result
417
+ end
418
+
419
+ promise.execute
420
+ end
421
+
422
+ #
423
+ # Get a list of all activity log alerts in a subscription.
424
+ #
425
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
426
+ # will be added to the HTTP request.
427
+ #
428
+ # @return [ActivityLogAlertList] operation results.
429
+ #
430
+ def list_by_subscription_id(custom_headers = nil)
431
+ response = list_by_subscription_id_async(custom_headers).value!
432
+ response.body unless response.nil?
433
+ end
434
+
435
+ #
436
+ # Get a list of all activity log alerts in a subscription.
437
+ #
438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
439
+ # will be added to the HTTP request.
440
+ #
441
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
442
+ #
443
+ def list_by_subscription_id_with_http_info(custom_headers = nil)
444
+ list_by_subscription_id_async(custom_headers).value!
445
+ end
446
+
447
+ #
448
+ # Get a list of all activity log alerts in a subscription.
449
+ #
450
+ # @param [Hash{String => String}] A hash of custom headers that will be added
451
+ # to the HTTP request.
452
+ #
453
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
454
+ #
455
+ def list_by_subscription_id_async(custom_headers = nil)
456
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
457
+ api_version = '2017-04-01'
458
+
459
+
460
+ request_headers = {}
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 = 'subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts'
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: {'subscriptionId' => @client.subscription_id},
472
+ query_params: {'api-version' => api_version},
473
+ headers: request_headers.merge(custom_headers || {}),
474
+ base_url: request_url
475
+ }
476
+ promise = @client.make_request_async(:get, path_template, options)
477
+
478
+ promise = promise.then do |result|
479
+ http_response = result.response
480
+ status_code = http_response.status
481
+ response_content = http_response.body
482
+ unless status_code == 200
483
+ error_model = JSON.load(response_content)
484
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
485
+ end
486
+
487
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
488
+ # Deserialize Response
489
+ if status_code == 200
490
+ begin
491
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
492
+ result_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertList.mapper()
493
+ result.body = @client.deserialize(result_mapper, parsed_response)
494
+ rescue Exception => e
495
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
496
+ end
497
+ end
498
+
499
+ result
500
+ end
501
+
502
+ promise.execute
503
+ end
504
+
505
+ #
506
+ # Get a list of all activity log alerts in a resource group.
507
+ #
508
+ # @param resource_group_name [String] The name of the resource group.
509
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
510
+ # will be added to the HTTP request.
511
+ #
512
+ # @return [ActivityLogAlertList] operation results.
513
+ #
514
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
515
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
516
+ response.body unless response.nil?
517
+ end
518
+
519
+ #
520
+ # Get a list of all activity log alerts in a resource group.
521
+ #
522
+ # @param resource_group_name [String] The name of the resource group.
523
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
524
+ # will be added to the HTTP request.
525
+ #
526
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
527
+ #
528
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
529
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
530
+ end
531
+
532
+ #
533
+ # Get a list of all activity log alerts in a resource group.
534
+ #
535
+ # @param resource_group_name [String] The name of the resource group.
536
+ # @param [Hash{String => String}] A hash of custom headers that will be added
537
+ # to the HTTP request.
538
+ #
539
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
540
+ #
541
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
542
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
543
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
544
+ api_version = '2017-04-01'
545
+
546
+
547
+ request_headers = {}
548
+
549
+ # Set Headers
550
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
551
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
552
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts'
553
+
554
+ request_url = @base_url || @client.base_url
555
+
556
+ options = {
557
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
558
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
559
+ query_params: {'api-version' => api_version},
560
+ headers: request_headers.merge(custom_headers || {}),
561
+ base_url: request_url
562
+ }
563
+ promise = @client.make_request_async(:get, path_template, options)
564
+
565
+ promise = promise.then do |result|
566
+ http_response = result.response
567
+ status_code = http_response.status
568
+ response_content = http_response.body
569
+ unless status_code == 200
570
+ error_model = JSON.load(response_content)
571
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
572
+ end
573
+
574
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
575
+ # Deserialize Response
576
+ if status_code == 200
577
+ begin
578
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
579
+ result_mapper = Azure::ARM::Monitor::Models::ActivityLogAlertList.mapper()
580
+ result.body = @client.deserialize(result_mapper, parsed_response)
581
+ rescue Exception => e
582
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
583
+ end
584
+ end
585
+
586
+ result
587
+ end
588
+
589
+ promise.execute
590
+ end
591
+
592
+ end
593
+ end