azure_mgmt_monitor 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
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,8 @@
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 end
7
+ module Azure::ARM end
8
+ module Azure::ARM::Monitor end
@@ -0,0 +1,150 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class MonitorManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The Azure subscription Id.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Gets or sets the preferred language for the response.
24
+ attr_accessor :accept_language
25
+
26
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
27
+ # Running Operations. Default value is 30.
28
+ attr_accessor :long_running_operation_retry_timeout
29
+
30
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
31
+ # is generated and included in each request. Default is true.
32
+ attr_accessor :generate_client_request_id
33
+
34
+ # @return [AutoscaleSettings] autoscale_settings
35
+ attr_reader :autoscale_settings
36
+
37
+ # @return [AlertRuleIncidents] alert_rule_incidents
38
+ attr_reader :alert_rule_incidents
39
+
40
+ # @return [AlertRules] alert_rules
41
+ attr_reader :alert_rules
42
+
43
+ # @return [LogProfiles] log_profiles
44
+ attr_reader :log_profiles
45
+
46
+ # @return [ServiceDiagnosticSettingsOperations]
47
+ # service_diagnostic_settings_operations
48
+ attr_reader :service_diagnostic_settings_operations
49
+
50
+ # @return [ActionGroups] action_groups
51
+ attr_reader :action_groups
52
+
53
+ # @return [ActivityLogAlerts] activity_log_alerts
54
+ attr_reader :activity_log_alerts
55
+
56
+ #
57
+ # Creates initializes a new instance of the MonitorManagementClient class.
58
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
59
+ # @param base_url [String] the base URI of the service.
60
+ # @param options [Array] filters to be applied to the HTTP requests.
61
+ #
62
+ def initialize(credentials = nil, base_url = nil, options = nil)
63
+ super(credentials, options)
64
+ @base_url = base_url || 'https://management.azure.com'
65
+
66
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
67
+ @credentials = credentials
68
+
69
+ @autoscale_settings = AutoscaleSettings.new(self)
70
+ @alert_rule_incidents = AlertRuleIncidents.new(self)
71
+ @alert_rules = AlertRules.new(self)
72
+ @log_profiles = LogProfiles.new(self)
73
+ @service_diagnostic_settings_operations = ServiceDiagnosticSettingsOperations.new(self)
74
+ @action_groups = ActionGroups.new(self)
75
+ @activity_log_alerts = ActivityLogAlerts.new(self)
76
+ @accept_language = 'en-US'
77
+ @long_running_operation_retry_timeout = 30
78
+ @generate_client_request_id = true
79
+ add_telemetry
80
+ end
81
+
82
+ #
83
+ # Makes a request and returns the body of the response.
84
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
85
+ # @param path [String] the path, relative to {base_url}.
86
+ # @param options [Hash{String=>String}] specifying any request options like :body.
87
+ # @return [Hash{String=>String}] containing the body of the response.
88
+ # Example:
89
+ #
90
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
91
+ # path = "/path"
92
+ # options = {
93
+ # body: request_content,
94
+ # query_params: {'api-version' => '2016-02-01'}
95
+ # }
96
+ # result = @client.make_request(:put, path, options)
97
+ #
98
+ def make_request(method, path, options = {})
99
+ result = make_request_with_http_info(method, path, options)
100
+ result.body unless result.nil?
101
+ end
102
+
103
+ #
104
+ # Makes a request and returns the operation response.
105
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
106
+ # @param path [String] the path, relative to {base_url}.
107
+ # @param options [Hash{String=>String}] specifying any request options like :body.
108
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
109
+ #
110
+ def make_request_with_http_info(method, path, options = {})
111
+ result = make_request_async(method, path, options).value!
112
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
113
+ result
114
+ end
115
+
116
+ #
117
+ # Makes a request asynchronously.
118
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
119
+ # @param path [String] the path, relative to {base_url}.
120
+ # @param options [Hash{String=>String}] specifying any request options like :body.
121
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
122
+ #
123
+ def make_request_async(method, path, options = {})
124
+ fail ArgumentError, 'method is nil' if method.nil?
125
+ fail ArgumentError, 'path is nil' if path.nil?
126
+
127
+ request_url = options[:base_url] || @base_url
128
+
129
+ request_headers = @request_headers
130
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
131
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
132
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
133
+
134
+ super(request_url, method, path, options)
135
+ end
136
+
137
+
138
+ private
139
+ #
140
+ # Adds telemetry information.
141
+ #
142
+ def add_telemetry
143
+ sdk_information = 'azure_mgmt_monitor'
144
+ if defined? Azure::ARM::Monitor::VERSION
145
+ sdk_information = "#{sdk_information}/#{Azure::ARM::Monitor::VERSION}"
146
+ end
147
+ add_user_agent_information(sdk_information)
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,330 @@
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 ServiceDiagnosticSettingsOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ServiceDiagnosticSettingsOperations 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
+ # Gets the active diagnostic settings for the specified resource. **WARNING**:
26
+ # This method will be deprecated in future releases.
27
+ #
28
+ # @param resource_uri [String] The identifier of the resource.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [ServiceDiagnosticSettingsResource] operation results.
33
+ #
34
+ def get(resource_uri, custom_headers = nil)
35
+ response = get_async(resource_uri, custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Gets the active diagnostic settings for the specified resource. **WARNING**:
41
+ # This method will be deprecated in future releases.
42
+ #
43
+ # @param resource_uri [String] The identifier of the resource.
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 get_with_http_info(resource_uri, custom_headers = nil)
50
+ get_async(resource_uri, custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Gets the active diagnostic settings for the specified resource. **WARNING**:
55
+ # This method will be deprecated in future releases.
56
+ #
57
+ # @param resource_uri [String] The identifier of the resource.
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 get_async(resource_uri, custom_headers = nil)
64
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
65
+ api_version = '2016-09-01'
66
+
67
+
68
+ request_headers = {}
69
+
70
+ # Set Headers
71
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
72
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
73
+ path_template = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'
74
+
75
+ request_url = @base_url || @client.base_url
76
+
77
+ options = {
78
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
79
+ path_params: {'resourceUri' => resource_uri},
80
+ query_params: {'api-version' => api_version},
81
+ headers: request_headers.merge(custom_headers || {}),
82
+ base_url: request_url
83
+ }
84
+ promise = @client.make_request_async(:get, path_template, options)
85
+
86
+ promise = promise.then do |result|
87
+ http_response = result.response
88
+ status_code = http_response.status
89
+ response_content = http_response.body
90
+ unless status_code == 200
91
+ error_model = JSON.load(response_content)
92
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
93
+ end
94
+
95
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
96
+ # Deserialize Response
97
+ if status_code == 200
98
+ begin
99
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
100
+ result_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.mapper()
101
+ result.body = @client.deserialize(result_mapper, parsed_response)
102
+ rescue Exception => e
103
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
104
+ end
105
+ end
106
+
107
+ result
108
+ end
109
+
110
+ promise.execute
111
+ end
112
+
113
+ #
114
+ # Create or update new diagnostic settings for the specified resource.
115
+ # **WARNING**: This method will be deprecated in future releases.
116
+ #
117
+ # @param resource_uri [String] The identifier of the resource.
118
+ # @param parameters [ServiceDiagnosticSettingsResource] Parameters supplied to
119
+ # the operation.
120
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
121
+ # will be added to the HTTP request.
122
+ #
123
+ # @return [ServiceDiagnosticSettingsResource] operation results.
124
+ #
125
+ def create_or_update(resource_uri, parameters, custom_headers = nil)
126
+ response = create_or_update_async(resource_uri, parameters, custom_headers).value!
127
+ response.body unless response.nil?
128
+ end
129
+
130
+ #
131
+ # Create or update new diagnostic settings for the specified resource.
132
+ # **WARNING**: This method will be deprecated in future releases.
133
+ #
134
+ # @param resource_uri [String] The identifier of the resource.
135
+ # @param parameters [ServiceDiagnosticSettingsResource] Parameters supplied to
136
+ # the operation.
137
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
138
+ # will be added to the HTTP request.
139
+ #
140
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
141
+ #
142
+ def create_or_update_with_http_info(resource_uri, parameters, custom_headers = nil)
143
+ create_or_update_async(resource_uri, parameters, custom_headers).value!
144
+ end
145
+
146
+ #
147
+ # Create or update new diagnostic settings for the specified resource.
148
+ # **WARNING**: This method will be deprecated in future releases.
149
+ #
150
+ # @param resource_uri [String] The identifier of the resource.
151
+ # @param parameters [ServiceDiagnosticSettingsResource] Parameters supplied to
152
+ # the operation.
153
+ # @param [Hash{String => String}] A hash of custom headers that will be added
154
+ # to the HTTP request.
155
+ #
156
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
157
+ #
158
+ def create_or_update_async(resource_uri, parameters, custom_headers = nil)
159
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
160
+ api_version = '2016-09-01'
161
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
162
+
163
+
164
+ request_headers = {}
165
+
166
+ # Set Headers
167
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
168
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
169
+
170
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
171
+
172
+ # Serialize Request
173
+ request_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.mapper()
174
+ request_content = @client.serialize(request_mapper, parameters)
175
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
176
+
177
+ path_template = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'
178
+
179
+ request_url = @base_url || @client.base_url
180
+
181
+ options = {
182
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
183
+ path_params: {'resourceUri' => resource_uri},
184
+ query_params: {'api-version' => api_version},
185
+ body: request_content,
186
+ headers: request_headers.merge(custom_headers || {}),
187
+ base_url: request_url
188
+ }
189
+ promise = @client.make_request_async(:put, path_template, options)
190
+
191
+ promise = promise.then do |result|
192
+ http_response = result.response
193
+ status_code = http_response.status
194
+ response_content = http_response.body
195
+ unless status_code == 200
196
+ error_model = JSON.load(response_content)
197
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
198
+ end
199
+
200
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
201
+ # Deserialize Response
202
+ if status_code == 200
203
+ begin
204
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
205
+ result_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.mapper()
206
+ result.body = @client.deserialize(result_mapper, parsed_response)
207
+ rescue Exception => e
208
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
209
+ end
210
+ end
211
+
212
+ result
213
+ end
214
+
215
+ promise.execute
216
+ end
217
+
218
+ #
219
+ # Updates an existing ServiceDiagnosticSettingsResource. To update other fields
220
+ # use the CreateOrUpdate method. **WARNING**: This method will be deprecated in
221
+ # future releases.
222
+ #
223
+ # @param resource_uri [String] The identifier of the resource.
224
+ # @param service_diagnostic_settings_resource
225
+ # [ServiceDiagnosticSettingsResourcePatch] Parameters supplied to the
226
+ # operation.
227
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
228
+ # will be added to the HTTP request.
229
+ #
230
+ # @return [ServiceDiagnosticSettingsResource] operation results.
231
+ #
232
+ def update(resource_uri, service_diagnostic_settings_resource, custom_headers = nil)
233
+ response = update_async(resource_uri, service_diagnostic_settings_resource, custom_headers).value!
234
+ response.body unless response.nil?
235
+ end
236
+
237
+ #
238
+ # Updates an existing ServiceDiagnosticSettingsResource. To update other fields
239
+ # use the CreateOrUpdate method. **WARNING**: This method will be deprecated in
240
+ # future releases.
241
+ #
242
+ # @param resource_uri [String] The identifier of the resource.
243
+ # @param service_diagnostic_settings_resource
244
+ # [ServiceDiagnosticSettingsResourcePatch] Parameters supplied to the
245
+ # operation.
246
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
247
+ # will be added to the HTTP request.
248
+ #
249
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
250
+ #
251
+ def update_with_http_info(resource_uri, service_diagnostic_settings_resource, custom_headers = nil)
252
+ update_async(resource_uri, service_diagnostic_settings_resource, custom_headers).value!
253
+ end
254
+
255
+ #
256
+ # Updates an existing ServiceDiagnosticSettingsResource. To update other fields
257
+ # use the CreateOrUpdate method. **WARNING**: This method will be deprecated in
258
+ # future releases.
259
+ #
260
+ # @param resource_uri [String] The identifier of the resource.
261
+ # @param service_diagnostic_settings_resource
262
+ # [ServiceDiagnosticSettingsResourcePatch] Parameters supplied to the
263
+ # operation.
264
+ # @param [Hash{String => String}] A hash of custom headers that will be added
265
+ # to the HTTP request.
266
+ #
267
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
268
+ #
269
+ def update_async(resource_uri, service_diagnostic_settings_resource, custom_headers = nil)
270
+ fail ArgumentError, 'resource_uri is nil' if resource_uri.nil?
271
+ api_version = '2016-09-01'
272
+ fail ArgumentError, 'service_diagnostic_settings_resource is nil' if service_diagnostic_settings_resource.nil?
273
+
274
+
275
+ request_headers = {}
276
+
277
+ # Set Headers
278
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
279
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
280
+
281
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
282
+
283
+ # Serialize Request
284
+ request_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResourcePatch.mapper()
285
+ request_content = @client.serialize(request_mapper, service_diagnostic_settings_resource)
286
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
287
+
288
+ path_template = '{resourceUri}/providers/microsoft.insights/diagnosticSettings/service'
289
+
290
+ request_url = @base_url || @client.base_url
291
+
292
+ options = {
293
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
294
+ path_params: {'resourceUri' => resource_uri},
295
+ query_params: {'api-version' => api_version},
296
+ body: request_content,
297
+ headers: request_headers.merge(custom_headers || {}),
298
+ base_url: request_url
299
+ }
300
+ promise = @client.make_request_async(:patch, path_template, options)
301
+
302
+ promise = promise.then do |result|
303
+ http_response = result.response
304
+ status_code = http_response.status
305
+ response_content = http_response.body
306
+ unless status_code == 200
307
+ error_model = JSON.load(response_content)
308
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
309
+ end
310
+
311
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
312
+ # Deserialize Response
313
+ if status_code == 200
314
+ begin
315
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
316
+ result_mapper = Azure::ARM::Monitor::Models::ServiceDiagnosticSettingsResource.mapper()
317
+ result.body = @client.deserialize(result_mapper, parsed_response)
318
+ rescue Exception => e
319
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
320
+ end
321
+ end
322
+
323
+ result
324
+ end
325
+
326
+ promise.execute
327
+ end
328
+
329
+ end
330
+ end