azure_mgmt_monitor 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-04-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  3. data/lib/2015-05-01/generated/azure_mgmt_monitor/application_insights_management_client.rb +1 -1
  4. data/lib/2016-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  5. data/lib/2016-09-01/generated/azure_mgmt_monitor/monitor_client.rb +1 -1
  6. data/lib/2017-04-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  7. data/lib/2017-05-01-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  8. data/lib/2017-10-01-preview/generated/azure_mgmt_monitor/application_insights_management_client.rb +1 -1
  9. data/lib/2017-11-01-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  10. data/lib/2017-12-01-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  11. data/lib/2018-01-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  12. data/lib/2018-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  13. data/lib/2018-04-16/generated/azure_mgmt_monitor/monitor_client.rb +1 -1
  14. data/lib/2018-06-01-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  15. data/lib/2018-06-17-preview/generated/azure_mgmt_monitor/application_insights_management_client.rb +1 -1
  16. data/lib/2018-09-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  17. data/lib/2018-11-27-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  18. data/lib/2019-03-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  19. data/lib/2019-06-01/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  20. data/lib/2019-10-17-preview/generated/azure_mgmt_monitor/monitor_management_client.rb +1 -1
  21. data/lib/2020-10-01/generated/azure_mgmt_monitor.rb +38 -0
  22. data/lib/2020-10-01/generated/azure_mgmt_monitor/activity_log_alerts.rb +884 -0
  23. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/action_group.rb +68 -0
  24. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/action_list.rb +55 -0
  25. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb +160 -0
  26. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_all_of_condition.rb +57 -0
  27. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_any_of_or_leaf_condition.rb +101 -0
  28. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_leaf_condition.rb +86 -0
  29. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_list.rb +100 -0
  30. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_patch_object.rb +68 -0
  31. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/azure_resource.rb +104 -0
  32. data/lib/2020-10-01/generated/azure_mgmt_monitor/models/error_response.rb +59 -0
  33. data/lib/2020-10-01/generated/azure_mgmt_monitor/module_definition.rb +9 -0
  34. data/lib/2020-10-01/generated/azure_mgmt_monitor/monitor_management_client.rb +131 -0
  35. data/lib/azure_mgmt_monitor.rb +1 -0
  36. data/lib/profiles/latest/modules/monitor_profile_module.rb +72 -64
  37. data/lib/version.rb +1 -1
  38. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78af93d1f9cd0616d44f297489715b496aaf04ffc96e0de39c4538a90c8d2800
4
- data.tar.gz: 8cc630b828ef3ffc9364b21dc17cb1a8df7406b951c601ff815682ceb20d6c25
3
+ metadata.gz: e9041da28abaa69cd1996cb9ee362e6468cf8073f5fec1fbe8ef338c112993d9
4
+ data.tar.gz: 47a5fa3f7889aa2290726499bada4424efaae2edae9d7e29b57b31c976250cbb
5
5
  SHA512:
6
- metadata.gz: b1664dc499bd32d13b95881cee7d01b7075e8a90e21e1a1abed0f479995a41e4424c4d698474d19aaa816aa1c004a2d36260e328b2dccbc00c78583edc0cd7c5
7
- data.tar.gz: 4db7bbebbe65f3c2c2b0628ffe45755d9e8e9c4713e9cb430d3c813e9e0c7112dbb8951acb0484c1108d4e7413469447a9dcdbe4a80d5f007ee7de5488e4ebca
6
+ metadata.gz: a52899a76e7374a9e065e2fa73d06c68dbb95f86c59814eb504324b24ab31137f026286c8d7b058935247775612558074f95a998c039641b34460ceb27fdcdbd
7
+ data.tar.gz: 55e23e1afbd43016ad45da05d97d5d59fbbd3f307fe574b9125b3977f2b644acf1d3a94c9dad8527609155849ebc9dc64ac9109240c096f75aeec203c2e20d2b
@@ -140,7 +140,7 @@ module Azure::Monitor::Mgmt::V2015_04_01
140
140
  #
141
141
  def add_telemetry
142
142
  sdk_information = 'azure_mgmt_monitor'
143
- sdk_information = "#{sdk_information}/0.18.0"
143
+ sdk_information = "#{sdk_information}/0.19.0"
144
144
  add_user_agent_information(sdk_information)
145
145
  end
146
146
  end
@@ -186,7 +186,7 @@ module Azure::Monitor::Mgmt::V2015_05_01
186
186
  #
187
187
  def add_telemetry
188
188
  sdk_information = 'azure_mgmt_monitor'
189
- sdk_information = "#{sdk_information}/0.18.0"
189
+ sdk_information = "#{sdk_information}/0.19.0"
190
190
  add_user_agent_information(sdk_information)
191
191
  end
192
192
  end
@@ -136,7 +136,7 @@ module Azure::Monitor::Mgmt::V2016_03_01
136
136
  #
137
137
  def add_telemetry
138
138
  sdk_information = 'azure_mgmt_monitor'
139
- sdk_information = "#{sdk_information}/0.18.0"
139
+ sdk_information = "#{sdk_information}/0.19.0"
140
140
  add_user_agent_information(sdk_information)
141
141
  end
142
142
  end
@@ -126,7 +126,7 @@ module Azure::Monitor::Mgmt::V2016_09_01
126
126
  #
127
127
  def add_telemetry
128
128
  sdk_information = 'azure_mgmt_monitor'
129
- sdk_information = "#{sdk_information}/0.18.0"
129
+ sdk_information = "#{sdk_information}/0.19.0"
130
130
  add_user_agent_information(sdk_information)
131
131
  end
132
132
  end
@@ -128,7 +128,7 @@ module Azure::Monitor::Mgmt::V2017_04_01
128
128
  #
129
129
  def add_telemetry
130
130
  sdk_information = 'azure_mgmt_monitor'
131
- sdk_information = "#{sdk_information}/0.18.0"
131
+ sdk_information = "#{sdk_information}/0.19.0"
132
132
  add_user_agent_information(sdk_information)
133
133
  end
134
134
  end
@@ -139,7 +139,7 @@ module Azure::Monitor::Mgmt::V2017_05_01_preview
139
139
  #
140
140
  def add_telemetry
141
141
  sdk_information = 'azure_mgmt_monitor'
142
- sdk_information = "#{sdk_information}/0.18.0"
142
+ sdk_information = "#{sdk_information}/0.19.0"
143
143
  add_user_agent_information(sdk_information)
144
144
  end
145
145
  end
@@ -139,7 +139,7 @@ module Azure::Monitor::Mgmt::V2017_10_01_preview
139
139
  #
140
140
  def add_telemetry
141
141
  sdk_information = 'azure_mgmt_monitor'
142
- sdk_information = "#{sdk_information}/0.18.0"
142
+ sdk_information = "#{sdk_information}/0.19.0"
143
143
  add_user_agent_information(sdk_information)
144
144
  end
145
145
  end
@@ -121,7 +121,7 @@ module Azure::Monitor::Mgmt::V2017_11_01_preview
121
121
  #
122
122
  def add_telemetry
123
123
  sdk_information = 'azure_mgmt_monitor'
124
- sdk_information = "#{sdk_information}/0.18.0"
124
+ sdk_information = "#{sdk_information}/0.19.0"
125
125
  add_user_agent_information(sdk_information)
126
126
  end
127
127
  end
@@ -121,7 +121,7 @@ module Azure::Monitor::Mgmt::V2017_12_01_preview
121
121
  #
122
122
  def add_telemetry
123
123
  sdk_information = 'azure_mgmt_monitor'
124
- sdk_information = "#{sdk_information}/0.18.0"
124
+ sdk_information = "#{sdk_information}/0.19.0"
125
125
  add_user_agent_information(sdk_information)
126
126
  end
127
127
  end
@@ -125,7 +125,7 @@ module Azure::Monitor::Mgmt::V2018_01_01
125
125
  #
126
126
  def add_telemetry
127
127
  sdk_information = 'azure_mgmt_monitor'
128
- sdk_information = "#{sdk_information}/0.18.0"
128
+ sdk_information = "#{sdk_information}/0.19.0"
129
129
  add_user_agent_information(sdk_information)
130
130
  end
131
131
  end
@@ -132,7 +132,7 @@ module Azure::Monitor::Mgmt::V2018_03_01
132
132
  #
133
133
  def add_telemetry
134
134
  sdk_information = 'azure_mgmt_monitor'
135
- sdk_information = "#{sdk_information}/0.18.0"
135
+ sdk_information = "#{sdk_information}/0.19.0"
136
136
  add_user_agent_information(sdk_information)
137
137
  end
138
138
  end
@@ -124,7 +124,7 @@ module Azure::Monitor::Mgmt::V2018_04_16
124
124
  #
125
125
  def add_telemetry
126
126
  sdk_information = 'azure_mgmt_monitor'
127
- sdk_information = "#{sdk_information}/0.18.0"
127
+ sdk_information = "#{sdk_information}/0.19.0"
128
128
  add_user_agent_information(sdk_information)
129
129
  end
130
130
  end
@@ -129,7 +129,7 @@ module Azure::Monitor::Mgmt::V2018_06_01_preview
129
129
  #
130
130
  def add_telemetry
131
131
  sdk_information = 'azure_mgmt_monitor'
132
- sdk_information = "#{sdk_information}/0.18.0"
132
+ sdk_information = "#{sdk_information}/0.19.0"
133
133
  add_user_agent_information(sdk_information)
134
134
  end
135
135
  end
@@ -124,7 +124,7 @@ module Azure::Monitor::Mgmt::V2018_06_17_preview
124
124
  #
125
125
  def add_telemetry
126
126
  sdk_information = 'azure_mgmt_monitor'
127
- sdk_information = "#{sdk_information}/0.18.0"
127
+ sdk_information = "#{sdk_information}/0.19.0"
128
128
  add_user_agent_information(sdk_information)
129
129
  end
130
130
  end
@@ -128,7 +128,7 @@ module Azure::Monitor::Mgmt::V2018_09_01
128
128
  #
129
129
  def add_telemetry
130
130
  sdk_information = 'azure_mgmt_monitor'
131
- sdk_information = "#{sdk_information}/0.18.0"
131
+ sdk_information = "#{sdk_information}/0.19.0"
132
132
  add_user_agent_information(sdk_information)
133
133
  end
134
134
  end
@@ -121,7 +121,7 @@ module Azure::Monitor::Mgmt::V2018_11_27_preview
121
121
  #
122
122
  def add_telemetry
123
123
  sdk_information = 'azure_mgmt_monitor'
124
- sdk_information = "#{sdk_information}/0.18.0"
124
+ sdk_information = "#{sdk_information}/0.19.0"
125
125
  add_user_agent_information(sdk_information)
126
126
  end
127
127
  end
@@ -128,7 +128,7 @@ module Azure::Monitor::Mgmt::V2019_03_01
128
128
  #
129
129
  def add_telemetry
130
130
  sdk_information = 'azure_mgmt_monitor'
131
- sdk_information = "#{sdk_information}/0.18.0"
131
+ sdk_information = "#{sdk_information}/0.19.0"
132
132
  add_user_agent_information(sdk_information)
133
133
  end
134
134
  end
@@ -124,7 +124,7 @@ module Azure::Monitor::Mgmt::V2019_06_01
124
124
  #
125
125
  def add_telemetry
126
126
  sdk_information = 'azure_mgmt_monitor'
127
- sdk_information = "#{sdk_information}/0.18.0"
127
+ sdk_information = "#{sdk_information}/0.19.0"
128
128
  add_user_agent_information(sdk_information)
129
129
  end
130
130
  end
@@ -141,7 +141,7 @@ module Azure::Monitor::Mgmt::V2019_10_17_preview
141
141
  #
142
142
  def add_telemetry
143
143
  sdk_information = 'azure_mgmt_monitor'
144
- sdk_information = "#{sdk_information}/0.18.0"
144
+ sdk_information = "#{sdk_information}/0.19.0"
145
145
  add_user_agent_information(sdk_information)
146
146
  end
147
147
  end
@@ -0,0 +1,38 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2020-10-01/generated/azure_mgmt_monitor/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Monitor::Mgmt::V2020_10_01
23
+ autoload :ActivityLogAlerts, '2020-10-01/generated/azure_mgmt_monitor/activity_log_alerts.rb'
24
+ autoload :MonitorManagementClient, '2020-10-01/generated/azure_mgmt_monitor/monitor_management_client.rb'
25
+
26
+ module Models
27
+ autoload :ActionList, '2020-10-01/generated/azure_mgmt_monitor/models/action_list.rb'
28
+ autoload :AzureResource, '2020-10-01/generated/azure_mgmt_monitor/models/azure_resource.rb'
29
+ autoload :AlertRuleLeafCondition, '2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_leaf_condition.rb'
30
+ autoload :AlertRuleAllOfCondition, '2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_all_of_condition.rb'
31
+ autoload :AlertRuleList, '2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_list.rb'
32
+ autoload :ErrorResponse, '2020-10-01/generated/azure_mgmt_monitor/models/error_response.rb'
33
+ autoload :ActionGroup, '2020-10-01/generated/azure_mgmt_monitor/models/action_group.rb'
34
+ autoload :AlertRulePatchObject, '2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_patch_object.rb'
35
+ autoload :AlertRuleAnyOfOrLeafCondition, '2020-10-01/generated/azure_mgmt_monitor/models/alert_rule_any_of_or_leaf_condition.rb'
36
+ autoload :ActivityLogAlertResource, '2020-10-01/generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb'
37
+ end
38
+ end
@@ -0,0 +1,884 @@
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::Monitor::Mgmt::V2020_10_01
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 rule or update an existing one.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group. The name
28
+ # is case insensitive.
29
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
30
+ # rule.
31
+ # @param activity_log_alert_rule [ActivityLogAlertResource] The Activity Log
32
+ # Alert rule to create or use for the update.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [ActivityLogAlertResource] operation results.
37
+ #
38
+ def create_or_update(resource_group_name, activity_log_alert_name, activity_log_alert_rule, custom_headers:nil)
39
+ response = create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert_rule, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Create a new Activity Log Alert rule or update an existing one.
45
+ #
46
+ # @param resource_group_name [String] The name of the resource group. The name
47
+ # is case insensitive.
48
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
49
+ # rule.
50
+ # @param activity_log_alert_rule [ActivityLogAlertResource] The Activity Log
51
+ # Alert rule to create or use for the update.
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def create_or_update_with_http_info(resource_group_name, activity_log_alert_name, activity_log_alert_rule, custom_headers:nil)
58
+ create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert_rule, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Create a new Activity Log Alert rule or update an existing one.
63
+ #
64
+ # @param resource_group_name [String] The name of the resource group. The name
65
+ # is case insensitive.
66
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
67
+ # rule.
68
+ # @param activity_log_alert_rule [ActivityLogAlertResource] The Activity Log
69
+ # Alert rule to create or use for the update.
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def create_or_update_async(resource_group_name, activity_log_alert_name, activity_log_alert_rule, custom_headers:nil)
76
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
77
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
78
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
79
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
80
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
81
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
82
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
83
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
84
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
85
+ fail ArgumentError, 'activity_log_alert_rule is nil' if activity_log_alert_rule.nil?
86
+
87
+
88
+ request_headers = {}
89
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+
95
+ # Serialize Request
96
+ request_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::ActivityLogAlertResource.mapper()
97
+ request_content = @client.serialize(request_mapper, activity_log_alert_rule)
98
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
99
+
100
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'
101
+
102
+ request_url = @base_url || @client.base_url
103
+
104
+ options = {
105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
106
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
107
+ query_params: {'api-version' => @client.api_version},
108
+ body: request_content,
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:put, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 200 || status_code == 201
119
+ error_model = JSON.load(response_content)
120
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
125
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
126
+ # Deserialize Response
127
+ if status_code == 200
128
+ begin
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
130
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::ActivityLogAlertResource.mapper()
131
+ result.body = @client.deserialize(result_mapper, parsed_response)
132
+ rescue Exception => e
133
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
134
+ end
135
+ end
136
+ # Deserialize Response
137
+ if status_code == 201
138
+ begin
139
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
140
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::ActivityLogAlertResource.mapper()
141
+ result.body = @client.deserialize(result_mapper, parsed_response)
142
+ rescue Exception => e
143
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
144
+ end
145
+ end
146
+
147
+ result
148
+ end
149
+
150
+ promise.execute
151
+ end
152
+
153
+ #
154
+ # Get an Activity Log Alert rule.
155
+ #
156
+ # @param resource_group_name [String] The name of the resource group. The name
157
+ # is case insensitive.
158
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
159
+ # rule.
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ # @return [ActivityLogAlertResource] operation results.
164
+ #
165
+ def get(resource_group_name, activity_log_alert_name, custom_headers:nil)
166
+ response = get_async(resource_group_name, activity_log_alert_name, custom_headers:custom_headers).value!
167
+ response.body unless response.nil?
168
+ end
169
+
170
+ #
171
+ # Get an Activity Log Alert rule.
172
+ #
173
+ # @param resource_group_name [String] The name of the resource group. The name
174
+ # is case insensitive.
175
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
176
+ # rule.
177
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
178
+ # will be added to the HTTP request.
179
+ #
180
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
181
+ #
182
+ def get_with_http_info(resource_group_name, activity_log_alert_name, custom_headers:nil)
183
+ get_async(resource_group_name, activity_log_alert_name, custom_headers:custom_headers).value!
184
+ end
185
+
186
+ #
187
+ # Get an Activity Log Alert rule.
188
+ #
189
+ # @param resource_group_name [String] The name of the resource group. The name
190
+ # is case insensitive.
191
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
192
+ # rule.
193
+ # @param [Hash{String => String}] A hash of custom headers that will be added
194
+ # to the HTTP request.
195
+ #
196
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
197
+ #
198
+ def get_async(resource_group_name, activity_log_alert_name, custom_headers:nil)
199
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
200
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
201
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
202
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
203
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
204
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
205
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
206
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
207
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
208
+
209
+
210
+ request_headers = {}
211
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
212
+
213
+ # Set Headers
214
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
215
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
216
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'
217
+
218
+ request_url = @base_url || @client.base_url
219
+
220
+ options = {
221
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
222
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
223
+ query_params: {'api-version' => @client.api_version},
224
+ headers: request_headers.merge(custom_headers || {}),
225
+ base_url: request_url
226
+ }
227
+ promise = @client.make_request_async(:get, path_template, options)
228
+
229
+ promise = promise.then do |result|
230
+ http_response = result.response
231
+ status_code = http_response.status
232
+ response_content = http_response.body
233
+ unless status_code == 200
234
+ error_model = JSON.load(response_content)
235
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
236
+ end
237
+
238
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
239
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
240
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
241
+ # Deserialize Response
242
+ if status_code == 200
243
+ begin
244
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
245
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::ActivityLogAlertResource.mapper()
246
+ result.body = @client.deserialize(result_mapper, parsed_response)
247
+ rescue Exception => e
248
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
249
+ end
250
+ end
251
+
252
+ result
253
+ end
254
+
255
+ promise.execute
256
+ end
257
+
258
+ #
259
+ # Delete an Activity Log Alert rule.
260
+ #
261
+ # @param resource_group_name [String] The name of the resource group. The name
262
+ # is case insensitive.
263
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
264
+ # rule.
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ #
269
+ def delete(resource_group_name, activity_log_alert_name, custom_headers:nil)
270
+ response = delete_async(resource_group_name, activity_log_alert_name, custom_headers:custom_headers).value!
271
+ nil
272
+ end
273
+
274
+ #
275
+ # Delete an Activity Log Alert rule.
276
+ #
277
+ # @param resource_group_name [String] The name of the resource group. The name
278
+ # is case insensitive.
279
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
280
+ # rule.
281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
282
+ # will be added to the HTTP request.
283
+ #
284
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
285
+ #
286
+ def delete_with_http_info(resource_group_name, activity_log_alert_name, custom_headers:nil)
287
+ delete_async(resource_group_name, activity_log_alert_name, custom_headers:custom_headers).value!
288
+ end
289
+
290
+ #
291
+ # Delete an Activity Log Alert rule.
292
+ #
293
+ # @param resource_group_name [String] The name of the resource group. The name
294
+ # is case insensitive.
295
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
296
+ # rule.
297
+ # @param [Hash{String => String}] A hash of custom headers that will be added
298
+ # to the HTTP request.
299
+ #
300
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
301
+ #
302
+ def delete_async(resource_group_name, activity_log_alert_name, custom_headers:nil)
303
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
304
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
305
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
306
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
307
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
308
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
309
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
310
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
311
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
312
+
313
+
314
+ request_headers = {}
315
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
316
+
317
+ # Set Headers
318
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
319
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
320
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'
321
+
322
+ request_url = @base_url || @client.base_url
323
+
324
+ options = {
325
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
326
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
327
+ query_params: {'api-version' => @client.api_version},
328
+ headers: request_headers.merge(custom_headers || {}),
329
+ base_url: request_url
330
+ }
331
+ promise = @client.make_request_async(:delete, path_template, options)
332
+
333
+ promise = promise.then do |result|
334
+ http_response = result.response
335
+ status_code = http_response.status
336
+ response_content = http_response.body
337
+ unless status_code == 200 || status_code == 204
338
+ error_model = JSON.load(response_content)
339
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
340
+ end
341
+
342
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
343
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
344
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
345
+
346
+ result
347
+ end
348
+
349
+ promise.execute
350
+ end
351
+
352
+ #
353
+ # Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is
354
+ # used to update the Alert rule tags, and to enable or disable the Alert rule.
355
+ # To update other fields use CreateOrUpdate operation.
356
+ #
357
+ # @param resource_group_name [String] The name of the resource group. The name
358
+ # is case insensitive.
359
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
360
+ # rule.
361
+ # @param activity_log_alert_rule_patch [AlertRulePatchObject] Parameters
362
+ # supplied to the operation.
363
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
364
+ # will be added to the HTTP request.
365
+ #
366
+ # @return [ActivityLogAlertResource] operation results.
367
+ #
368
+ def update(resource_group_name, activity_log_alert_name, activity_log_alert_rule_patch, custom_headers:nil)
369
+ response = update_async(resource_group_name, activity_log_alert_name, activity_log_alert_rule_patch, custom_headers:custom_headers).value!
370
+ response.body unless response.nil?
371
+ end
372
+
373
+ #
374
+ # Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is
375
+ # used to update the Alert rule tags, and to enable or disable the Alert rule.
376
+ # To update other fields use CreateOrUpdate operation.
377
+ #
378
+ # @param resource_group_name [String] The name of the resource group. The name
379
+ # is case insensitive.
380
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
381
+ # rule.
382
+ # @param activity_log_alert_rule_patch [AlertRulePatchObject] Parameters
383
+ # supplied to the operation.
384
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
385
+ # will be added to the HTTP request.
386
+ #
387
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
388
+ #
389
+ def update_with_http_info(resource_group_name, activity_log_alert_name, activity_log_alert_rule_patch, custom_headers:nil)
390
+ update_async(resource_group_name, activity_log_alert_name, activity_log_alert_rule_patch, custom_headers:custom_headers).value!
391
+ end
392
+
393
+ #
394
+ # Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is
395
+ # used to update the Alert rule tags, and to enable or disable the Alert rule.
396
+ # To update other fields use CreateOrUpdate operation.
397
+ #
398
+ # @param resource_group_name [String] The name of the resource group. The name
399
+ # is case insensitive.
400
+ # @param activity_log_alert_name [String] The name of the Activity Log Alert
401
+ # rule.
402
+ # @param activity_log_alert_rule_patch [AlertRulePatchObject] Parameters
403
+ # supplied to the operation.
404
+ # @param [Hash{String => String}] A hash of custom headers that will be added
405
+ # to the HTTP request.
406
+ #
407
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
408
+ #
409
+ def update_async(resource_group_name, activity_log_alert_name, activity_log_alert_rule_patch, custom_headers:nil)
410
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
411
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
412
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
413
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
414
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
415
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
416
+ fail ArgumentError, 'activity_log_alert_name is nil' if activity_log_alert_name.nil?
417
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
418
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
419
+ fail ArgumentError, 'activity_log_alert_rule_patch is nil' if activity_log_alert_rule_patch.nil?
420
+
421
+
422
+ request_headers = {}
423
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
424
+
425
+ # Set Headers
426
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
427
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
428
+
429
+ # Serialize Request
430
+ request_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::AlertRulePatchObject.mapper()
431
+ request_content = @client.serialize(request_mapper, activity_log_alert_rule_patch)
432
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
433
+
434
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}'
435
+
436
+ request_url = @base_url || @client.base_url
437
+
438
+ options = {
439
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
440
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'activityLogAlertName' => activity_log_alert_name},
441
+ query_params: {'api-version' => @client.api_version},
442
+ body: request_content,
443
+ headers: request_headers.merge(custom_headers || {}),
444
+ base_url: request_url
445
+ }
446
+ promise = @client.make_request_async(:patch, path_template, options)
447
+
448
+ promise = promise.then do |result|
449
+ http_response = result.response
450
+ status_code = http_response.status
451
+ response_content = http_response.body
452
+ unless status_code == 200
453
+ error_model = JSON.load(response_content)
454
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
455
+ end
456
+
457
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
458
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
459
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
460
+ # Deserialize Response
461
+ if status_code == 200
462
+ begin
463
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
464
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::ActivityLogAlertResource.mapper()
465
+ result.body = @client.deserialize(result_mapper, parsed_response)
466
+ rescue Exception => e
467
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
468
+ end
469
+ end
470
+
471
+ result
472
+ end
473
+
474
+ promise.execute
475
+ end
476
+
477
+ #
478
+ # Get a list of all Activity Log Alert rules in a subscription.
479
+ #
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [Array<ActivityLogAlertResource>] operation results.
484
+ #
485
+ def list_by_subscription_id(custom_headers:nil)
486
+ first_page = list_by_subscription_id_as_lazy(custom_headers:custom_headers)
487
+ first_page.get_all_items
488
+ end
489
+
490
+ #
491
+ # Get a list of all Activity Log Alert rules in a subscription.
492
+ #
493
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
494
+ # will be added to the HTTP request.
495
+ #
496
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
497
+ #
498
+ def list_by_subscription_id_with_http_info(custom_headers:nil)
499
+ list_by_subscription_id_async(custom_headers:custom_headers).value!
500
+ end
501
+
502
+ #
503
+ # Get a list of all Activity Log Alert rules in a subscription.
504
+ #
505
+ # @param [Hash{String => String}] A hash of custom headers that will be added
506
+ # to the HTTP request.
507
+ #
508
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
509
+ #
510
+ def list_by_subscription_id_async(custom_headers:nil)
511
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
512
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
513
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
514
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
515
+
516
+
517
+ request_headers = {}
518
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
519
+
520
+ # Set Headers
521
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
522
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
523
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts'
524
+
525
+ request_url = @base_url || @client.base_url
526
+
527
+ options = {
528
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
529
+ path_params: {'subscriptionId' => @client.subscription_id},
530
+ query_params: {'api-version' => @client.api_version},
531
+ headers: request_headers.merge(custom_headers || {}),
532
+ base_url: request_url
533
+ }
534
+ promise = @client.make_request_async(:get, path_template, options)
535
+
536
+ promise = promise.then do |result|
537
+ http_response = result.response
538
+ status_code = http_response.status
539
+ response_content = http_response.body
540
+ unless status_code == 200
541
+ error_model = JSON.load(response_content)
542
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
543
+ end
544
+
545
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
546
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
547
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
548
+ # Deserialize Response
549
+ if status_code == 200
550
+ begin
551
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
552
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::AlertRuleList.mapper()
553
+ result.body = @client.deserialize(result_mapper, parsed_response)
554
+ rescue Exception => e
555
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
556
+ end
557
+ end
558
+
559
+ result
560
+ end
561
+
562
+ promise.execute
563
+ end
564
+
565
+ #
566
+ # Get a list of all Activity Log Alert rules in a resource group.
567
+ #
568
+ # @param resource_group_name [String] The name of the resource group. The name
569
+ # is case insensitive.
570
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
571
+ # will be added to the HTTP request.
572
+ #
573
+ # @return [Array<ActivityLogAlertResource>] operation results.
574
+ #
575
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
576
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
577
+ first_page.get_all_items
578
+ end
579
+
580
+ #
581
+ # Get a list of all Activity Log Alert rules in a resource group.
582
+ #
583
+ # @param resource_group_name [String] The name of the resource group. The name
584
+ # is case insensitive.
585
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
586
+ # will be added to the HTTP request.
587
+ #
588
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
589
+ #
590
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
591
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
592
+ end
593
+
594
+ #
595
+ # Get a list of all Activity Log Alert rules in a resource group.
596
+ #
597
+ # @param resource_group_name [String] The name of the resource group. The name
598
+ # is case insensitive.
599
+ # @param [Hash{String => String}] A hash of custom headers that will be added
600
+ # to the HTTP request.
601
+ #
602
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
603
+ #
604
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
605
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
606
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
607
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
608
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
609
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
610
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
611
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
612
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
613
+
614
+
615
+ request_headers = {}
616
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
617
+
618
+ # Set Headers
619
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
620
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
621
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts'
622
+
623
+ request_url = @base_url || @client.base_url
624
+
625
+ options = {
626
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
627
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
628
+ query_params: {'api-version' => @client.api_version},
629
+ headers: request_headers.merge(custom_headers || {}),
630
+ base_url: request_url
631
+ }
632
+ promise = @client.make_request_async(:get, path_template, options)
633
+
634
+ promise = promise.then do |result|
635
+ http_response = result.response
636
+ status_code = http_response.status
637
+ response_content = http_response.body
638
+ unless status_code == 200
639
+ error_model = JSON.load(response_content)
640
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
641
+ end
642
+
643
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
644
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
645
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
646
+ # Deserialize Response
647
+ if status_code == 200
648
+ begin
649
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
650
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::AlertRuleList.mapper()
651
+ result.body = @client.deserialize(result_mapper, parsed_response)
652
+ rescue Exception => e
653
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
654
+ end
655
+ end
656
+
657
+ result
658
+ end
659
+
660
+ promise.execute
661
+ end
662
+
663
+ #
664
+ # Get a list of all Activity Log Alert rules in a subscription.
665
+ #
666
+ # @param next_page_link [String] The NextLink from the previous successful call
667
+ # to List operation.
668
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
669
+ # will be added to the HTTP request.
670
+ #
671
+ # @return [AlertRuleList] operation results.
672
+ #
673
+ def list_by_subscription_id_next(next_page_link, custom_headers:nil)
674
+ response = list_by_subscription_id_next_async(next_page_link, custom_headers:custom_headers).value!
675
+ response.body unless response.nil?
676
+ end
677
+
678
+ #
679
+ # Get a list of all Activity Log Alert rules in a subscription.
680
+ #
681
+ # @param next_page_link [String] The NextLink from the previous successful call
682
+ # to List operation.
683
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
684
+ # will be added to the HTTP request.
685
+ #
686
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
687
+ #
688
+ def list_by_subscription_id_next_with_http_info(next_page_link, custom_headers:nil)
689
+ list_by_subscription_id_next_async(next_page_link, custom_headers:custom_headers).value!
690
+ end
691
+
692
+ #
693
+ # Get a list of all Activity Log Alert rules in a subscription.
694
+ #
695
+ # @param next_page_link [String] The NextLink from the previous successful call
696
+ # to List operation.
697
+ # @param [Hash{String => String}] A hash of custom headers that will be added
698
+ # to the HTTP request.
699
+ #
700
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
701
+ #
702
+ def list_by_subscription_id_next_async(next_page_link, custom_headers:nil)
703
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
704
+
705
+
706
+ request_headers = {}
707
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
708
+
709
+ # Set Headers
710
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
711
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
712
+ path_template = '{nextLink}'
713
+
714
+ request_url = @base_url || @client.base_url
715
+
716
+ options = {
717
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
718
+ skip_encoding_path_params: {'nextLink' => next_page_link},
719
+ headers: request_headers.merge(custom_headers || {}),
720
+ base_url: request_url
721
+ }
722
+ promise = @client.make_request_async(:get, path_template, options)
723
+
724
+ promise = promise.then do |result|
725
+ http_response = result.response
726
+ status_code = http_response.status
727
+ response_content = http_response.body
728
+ unless status_code == 200
729
+ error_model = JSON.load(response_content)
730
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
731
+ end
732
+
733
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
734
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
735
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
736
+ # Deserialize Response
737
+ if status_code == 200
738
+ begin
739
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
740
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::AlertRuleList.mapper()
741
+ result.body = @client.deserialize(result_mapper, parsed_response)
742
+ rescue Exception => e
743
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
744
+ end
745
+ end
746
+
747
+ result
748
+ end
749
+
750
+ promise.execute
751
+ end
752
+
753
+ #
754
+ # Get a list of all Activity Log Alert rules in a resource group.
755
+ #
756
+ # @param next_page_link [String] The NextLink from the previous successful call
757
+ # to List operation.
758
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
759
+ # will be added to the HTTP request.
760
+ #
761
+ # @return [AlertRuleList] operation results.
762
+ #
763
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
764
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
765
+ response.body unless response.nil?
766
+ end
767
+
768
+ #
769
+ # Get a list of all Activity Log Alert rules in a resource group.
770
+ #
771
+ # @param next_page_link [String] The NextLink from the previous successful call
772
+ # to List operation.
773
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
774
+ # will be added to the HTTP request.
775
+ #
776
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
777
+ #
778
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
779
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
780
+ end
781
+
782
+ #
783
+ # Get a list of all Activity Log Alert rules in a resource group.
784
+ #
785
+ # @param next_page_link [String] The NextLink from the previous successful call
786
+ # to List operation.
787
+ # @param [Hash{String => String}] A hash of custom headers that will be added
788
+ # to the HTTP request.
789
+ #
790
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
791
+ #
792
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
793
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
794
+
795
+
796
+ request_headers = {}
797
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
798
+
799
+ # Set Headers
800
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
801
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
802
+ path_template = '{nextLink}'
803
+
804
+ request_url = @base_url || @client.base_url
805
+
806
+ options = {
807
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
808
+ skip_encoding_path_params: {'nextLink' => next_page_link},
809
+ headers: request_headers.merge(custom_headers || {}),
810
+ base_url: request_url
811
+ }
812
+ promise = @client.make_request_async(:get, path_template, options)
813
+
814
+ promise = promise.then do |result|
815
+ http_response = result.response
816
+ status_code = http_response.status
817
+ response_content = http_response.body
818
+ unless status_code == 200
819
+ error_model = JSON.load(response_content)
820
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
821
+ end
822
+
823
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
824
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
825
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
826
+ # Deserialize Response
827
+ if status_code == 200
828
+ begin
829
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
830
+ result_mapper = Azure::Monitor::Mgmt::V2020_10_01::Models::AlertRuleList.mapper()
831
+ result.body = @client.deserialize(result_mapper, parsed_response)
832
+ rescue Exception => e
833
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
834
+ end
835
+ end
836
+
837
+ result
838
+ end
839
+
840
+ promise.execute
841
+ end
842
+
843
+ #
844
+ # Get a list of all Activity Log Alert rules in a subscription.
845
+ #
846
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
847
+ # will be added to the HTTP request.
848
+ #
849
+ # @return [AlertRuleList] which provide lazy access to pages of the response.
850
+ #
851
+ def list_by_subscription_id_as_lazy(custom_headers:nil)
852
+ response = list_by_subscription_id_async(custom_headers:custom_headers).value!
853
+ unless response.nil?
854
+ page = response.body
855
+ page.next_method = Proc.new do |next_page_link|
856
+ list_by_subscription_id_next_async(next_page_link, custom_headers:custom_headers)
857
+ end
858
+ page
859
+ end
860
+ end
861
+
862
+ #
863
+ # Get a list of all Activity Log Alert rules in a resource group.
864
+ #
865
+ # @param resource_group_name [String] The name of the resource group. The name
866
+ # is case insensitive.
867
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
868
+ # will be added to the HTTP request.
869
+ #
870
+ # @return [AlertRuleList] which provide lazy access to pages of the response.
871
+ #
872
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
873
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
874
+ unless response.nil?
875
+ page = response.body
876
+ page.next_method = Proc.new do |next_page_link|
877
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
878
+ end
879
+ page
880
+ end
881
+ end
882
+
883
+ end
884
+ end