azure_mgmt_monitor 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/azure_mgmt_monitor.rb +5 -0
- data/lib/generated/azure_mgmt_monitor.rb +96 -0
- data/lib/generated/azure_mgmt_monitor/action_groups.rb +579 -0
- data/lib/generated/azure_mgmt_monitor/activity_log_alerts.rb +593 -0
- data/lib/generated/azure_mgmt_monitor/alert_rule_incidents.rb +211 -0
- data/lib/generated/azure_mgmt_monitor/alert_rules.rb +510 -0
- data/lib/generated/azure_mgmt_monitor/autoscale_settings.rb +618 -0
- data/lib/generated/azure_mgmt_monitor/log_profiles.rb +477 -0
- data/lib/generated/azure_mgmt_monitor/models/action_group_list.rb +63 -0
- data/lib/generated/azure_mgmt_monitor/models/action_group_resource.rb +164 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_group.rb +65 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_action_list.rb +54 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_all_of_condition.rb +55 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_leaf_condition.rb +61 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_list.rb +64 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_patch_body.rb +65 -0
- data/lib/generated/azure_mgmt_monitor/models/activity_log_alert_resource.rb +147 -0
- data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource.rb +159 -0
- data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_collection.rb +54 -0
- data/lib/generated/azure_mgmt_monitor/models/alert_rule_resource_patch.rb +131 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_notification.rb +78 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_profile.rb +101 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource.rb +155 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_collection.rb +95 -0
- data/lib/generated/azure_mgmt_monitor/models/autoscale_setting_resource_patch.rb +127 -0
- data/lib/generated/azure_mgmt_monitor/models/comparison_operation_type.rb +20 -0
- data/lib/generated/azure_mgmt_monitor/models/condition_operator.rb +18 -0
- data/lib/generated/azure_mgmt_monitor/models/email_notification.rb +75 -0
- data/lib/generated/azure_mgmt_monitor/models/email_receiver.rb +69 -0
- data/lib/generated/azure_mgmt_monitor/models/enable_request.rb +45 -0
- data/lib/generated/azure_mgmt_monitor/models/error_response.rb +55 -0
- data/lib/generated/azure_mgmt_monitor/models/incident.rb +93 -0
- data/lib/generated/azure_mgmt_monitor/models/incident_list_result.rb +53 -0
- data/lib/generated/azure_mgmt_monitor/models/location_threshold_rule_condition.rb +85 -0
- data/lib/generated/azure_mgmt_monitor/models/log_profile_collection.rb +53 -0
- data/lib/generated/azure_mgmt_monitor/models/log_profile_resource.rb +154 -0
- data/lib/generated/azure_mgmt_monitor/models/log_profile_resource_patch.rb +126 -0
- data/lib/generated/azure_mgmt_monitor/models/log_settings.rb +70 -0
- data/lib/generated/azure_mgmt_monitor/models/management_event_aggregation_condition.rb +70 -0
- data/lib/generated/azure_mgmt_monitor/models/management_event_rule_condition.rb +73 -0
- data/lib/generated/azure_mgmt_monitor/models/metric_settings.rb +67 -0
- data/lib/generated/azure_mgmt_monitor/models/metric_statistic_type.rb +18 -0
- data/lib/generated/azure_mgmt_monitor/models/metric_trigger.rb +134 -0
- data/lib/generated/azure_mgmt_monitor/models/receiver_status.rb +17 -0
- data/lib/generated/azure_mgmt_monitor/models/recurrence.rb +62 -0
- data/lib/generated/azure_mgmt_monitor/models/recurrence_frequency.rb +22 -0
- data/lib/generated/azure_mgmt_monitor/models/recurrent_schedule.rb +139 -0
- data/lib/generated/azure_mgmt_monitor/models/retention_policy.rb +60 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_action.rb +48 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_condition.rb +63 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_data_source.rb +58 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_email_action.rb +80 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_management_event_claims_data_source.rb +45 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_management_event_data_source.rb +150 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_metric_data_source.rb +68 -0
- data/lib/generated/azure_mgmt_monitor/models/rule_webhook_action.rb +80 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_action.rb +86 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_capacity.rb +69 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_direction.rb +17 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_rule.rb +57 -0
- data/lib/generated/azure_mgmt_monitor/models/scale_type.rb +17 -0
- data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource.rb +163 -0
- data/lib/generated/azure_mgmt_monitor/models/service_diagnostic_settings_resource_patch.rb +135 -0
- data/lib/generated/azure_mgmt_monitor/models/sms_receiver.rb +79 -0
- data/lib/generated/azure_mgmt_monitor/models/threshold_rule_condition.rb +108 -0
- data/lib/generated/azure_mgmt_monitor/models/time_aggregation_operator.rb +19 -0
- data/lib/generated/azure_mgmt_monitor/models/time_aggregation_type.rb +19 -0
- data/lib/generated/azure_mgmt_monitor/models/time_window.rb +104 -0
- data/lib/generated/azure_mgmt_monitor/models/webhook_notification.rb +63 -0
- data/lib/generated/azure_mgmt_monitor/models/webhook_receiver.rb +56 -0
- data/lib/generated/azure_mgmt_monitor/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_monitor/monitor_management_client.rb +150 -0
- data/lib/generated/azure_mgmt_monitor/service_diagnostic_settings_operations.rb +330 -0
- data/lib/generated/azure_mgmt_monitor/version.rb +8 -0
- metadata +188 -0
@@ -0,0 +1,477 @@
|
|
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 LogProfiles
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the LogProfiles 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
|
+
# Deletes the log profile.
|
26
|
+
#
|
27
|
+
# @param log_profile_name [String] The name of the log profile.
|
28
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
29
|
+
# will be added to the HTTP request.
|
30
|
+
#
|
31
|
+
#
|
32
|
+
def delete(log_profile_name, custom_headers = nil)
|
33
|
+
response = delete_async(log_profile_name, custom_headers).value!
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# Deletes the log profile.
|
39
|
+
#
|
40
|
+
# @param log_profile_name [String] The name of the log profile.
|
41
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
42
|
+
# will be added to the HTTP request.
|
43
|
+
#
|
44
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
45
|
+
#
|
46
|
+
def delete_with_http_info(log_profile_name, custom_headers = nil)
|
47
|
+
delete_async(log_profile_name, custom_headers).value!
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Deletes the log profile.
|
52
|
+
#
|
53
|
+
# @param log_profile_name [String] The name of the log profile.
|
54
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
55
|
+
# to the HTTP request.
|
56
|
+
#
|
57
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
58
|
+
#
|
59
|
+
def delete_async(log_profile_name, custom_headers = nil)
|
60
|
+
fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
|
61
|
+
api_version = '2016-03-01'
|
62
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
63
|
+
|
64
|
+
|
65
|
+
request_headers = {}
|
66
|
+
|
67
|
+
# Set Headers
|
68
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
69
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
70
|
+
path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'
|
71
|
+
|
72
|
+
request_url = @base_url || @client.base_url
|
73
|
+
|
74
|
+
options = {
|
75
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
76
|
+
path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
|
77
|
+
query_params: {'api-version' => api_version},
|
78
|
+
headers: request_headers.merge(custom_headers || {}),
|
79
|
+
base_url: request_url
|
80
|
+
}
|
81
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
82
|
+
|
83
|
+
promise = promise.then do |result|
|
84
|
+
http_response = result.response
|
85
|
+
status_code = http_response.status
|
86
|
+
response_content = http_response.body
|
87
|
+
unless status_code == 200
|
88
|
+
error_model = JSON.load(response_content)
|
89
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
90
|
+
end
|
91
|
+
|
92
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
93
|
+
|
94
|
+
result
|
95
|
+
end
|
96
|
+
|
97
|
+
promise.execute
|
98
|
+
end
|
99
|
+
|
100
|
+
#
|
101
|
+
# Gets the log profile.
|
102
|
+
#
|
103
|
+
# @param log_profile_name [String] The name of the log profile.
|
104
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
105
|
+
# will be added to the HTTP request.
|
106
|
+
#
|
107
|
+
# @return [LogProfileResource] operation results.
|
108
|
+
#
|
109
|
+
def get(log_profile_name, custom_headers = nil)
|
110
|
+
response = get_async(log_profile_name, custom_headers).value!
|
111
|
+
response.body unless response.nil?
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
# Gets the log profile.
|
116
|
+
#
|
117
|
+
# @param log_profile_name [String] The name of the log profile.
|
118
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
119
|
+
# will be added to the HTTP request.
|
120
|
+
#
|
121
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
122
|
+
#
|
123
|
+
def get_with_http_info(log_profile_name, custom_headers = nil)
|
124
|
+
get_async(log_profile_name, custom_headers).value!
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
# Gets the log profile.
|
129
|
+
#
|
130
|
+
# @param log_profile_name [String] The name of the log profile.
|
131
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
132
|
+
# to the HTTP request.
|
133
|
+
#
|
134
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
135
|
+
#
|
136
|
+
def get_async(log_profile_name, custom_headers = nil)
|
137
|
+
fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
|
138
|
+
api_version = '2016-03-01'
|
139
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
140
|
+
|
141
|
+
|
142
|
+
request_headers = {}
|
143
|
+
|
144
|
+
# Set Headers
|
145
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
146
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
147
|
+
path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'
|
148
|
+
|
149
|
+
request_url = @base_url || @client.base_url
|
150
|
+
|
151
|
+
options = {
|
152
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
153
|
+
path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
|
154
|
+
query_params: {'api-version' => api_version},
|
155
|
+
headers: request_headers.merge(custom_headers || {}),
|
156
|
+
base_url: request_url
|
157
|
+
}
|
158
|
+
promise = @client.make_request_async(:get, path_template, options)
|
159
|
+
|
160
|
+
promise = promise.then do |result|
|
161
|
+
http_response = result.response
|
162
|
+
status_code = http_response.status
|
163
|
+
response_content = http_response.body
|
164
|
+
unless status_code == 200
|
165
|
+
error_model = JSON.load(response_content)
|
166
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
167
|
+
end
|
168
|
+
|
169
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
170
|
+
# Deserialize Response
|
171
|
+
if status_code == 200
|
172
|
+
begin
|
173
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
174
|
+
result_mapper = Azure::ARM::Monitor::Models::LogProfileResource.mapper()
|
175
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
176
|
+
rescue Exception => e
|
177
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
result
|
182
|
+
end
|
183
|
+
|
184
|
+
promise.execute
|
185
|
+
end
|
186
|
+
|
187
|
+
#
|
188
|
+
# Create or update a log profile in Azure Monitoring REST API.
|
189
|
+
#
|
190
|
+
# @param log_profile_name [String] The name of the log profile.
|
191
|
+
# @param parameters [LogProfileResource] Parameters supplied to the operation.
|
192
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
193
|
+
# will be added to the HTTP request.
|
194
|
+
#
|
195
|
+
# @return [LogProfileResource] operation results.
|
196
|
+
#
|
197
|
+
def create_or_update(log_profile_name, parameters, custom_headers = nil)
|
198
|
+
response = create_or_update_async(log_profile_name, parameters, custom_headers).value!
|
199
|
+
response.body unless response.nil?
|
200
|
+
end
|
201
|
+
|
202
|
+
#
|
203
|
+
# Create or update a log profile in Azure Monitoring REST API.
|
204
|
+
#
|
205
|
+
# @param log_profile_name [String] The name of the log profile.
|
206
|
+
# @param parameters [LogProfileResource] Parameters supplied to the operation.
|
207
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
208
|
+
# will be added to the HTTP request.
|
209
|
+
#
|
210
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
211
|
+
#
|
212
|
+
def create_or_update_with_http_info(log_profile_name, parameters, custom_headers = nil)
|
213
|
+
create_or_update_async(log_profile_name, parameters, custom_headers).value!
|
214
|
+
end
|
215
|
+
|
216
|
+
#
|
217
|
+
# Create or update a log profile in Azure Monitoring REST API.
|
218
|
+
#
|
219
|
+
# @param log_profile_name [String] The name of the log profile.
|
220
|
+
# @param parameters [LogProfileResource] Parameters supplied to the operation.
|
221
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
222
|
+
# to the HTTP request.
|
223
|
+
#
|
224
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
225
|
+
#
|
226
|
+
def create_or_update_async(log_profile_name, parameters, custom_headers = nil)
|
227
|
+
fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
|
228
|
+
api_version = '2016-03-01'
|
229
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
230
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
231
|
+
|
232
|
+
|
233
|
+
request_headers = {}
|
234
|
+
|
235
|
+
# Set Headers
|
236
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
237
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
238
|
+
|
239
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
240
|
+
|
241
|
+
# Serialize Request
|
242
|
+
request_mapper = Azure::ARM::Monitor::Models::LogProfileResource.mapper()
|
243
|
+
request_content = @client.serialize(request_mapper, parameters)
|
244
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
245
|
+
|
246
|
+
path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'
|
247
|
+
|
248
|
+
request_url = @base_url || @client.base_url
|
249
|
+
|
250
|
+
options = {
|
251
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
252
|
+
path_params: {'logProfileName' => log_profile_name,'subscriptionId' => @client.subscription_id},
|
253
|
+
query_params: {'api-version' => api_version},
|
254
|
+
body: request_content,
|
255
|
+
headers: request_headers.merge(custom_headers || {}),
|
256
|
+
base_url: request_url
|
257
|
+
}
|
258
|
+
promise = @client.make_request_async(:put, path_template, options)
|
259
|
+
|
260
|
+
promise = promise.then do |result|
|
261
|
+
http_response = result.response
|
262
|
+
status_code = http_response.status
|
263
|
+
response_content = http_response.body
|
264
|
+
unless status_code == 200
|
265
|
+
error_model = JSON.load(response_content)
|
266
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
267
|
+
end
|
268
|
+
|
269
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
270
|
+
# Deserialize Response
|
271
|
+
if status_code == 200
|
272
|
+
begin
|
273
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
274
|
+
result_mapper = Azure::ARM::Monitor::Models::LogProfileResource.mapper()
|
275
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
276
|
+
rescue Exception => e
|
277
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
result
|
282
|
+
end
|
283
|
+
|
284
|
+
promise.execute
|
285
|
+
end
|
286
|
+
|
287
|
+
#
|
288
|
+
# Updates an existing LogProfilesResource. To update other fields use the
|
289
|
+
# CreateOrUpdate method.
|
290
|
+
#
|
291
|
+
# @param log_profile_name [String] The name of the log profile.
|
292
|
+
# @param log_profiles_resource [LogProfileResourcePatch] Parameters supplied to
|
293
|
+
# the operation.
|
294
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
295
|
+
# will be added to the HTTP request.
|
296
|
+
#
|
297
|
+
# @return [LogProfileResource] operation results.
|
298
|
+
#
|
299
|
+
def update(log_profile_name, log_profiles_resource, custom_headers = nil)
|
300
|
+
response = update_async(log_profile_name, log_profiles_resource, custom_headers).value!
|
301
|
+
response.body unless response.nil?
|
302
|
+
end
|
303
|
+
|
304
|
+
#
|
305
|
+
# Updates an existing LogProfilesResource. To update other fields use the
|
306
|
+
# CreateOrUpdate method.
|
307
|
+
#
|
308
|
+
# @param log_profile_name [String] The name of the log profile.
|
309
|
+
# @param log_profiles_resource [LogProfileResourcePatch] Parameters supplied to
|
310
|
+
# the operation.
|
311
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
312
|
+
# will be added to the HTTP request.
|
313
|
+
#
|
314
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
315
|
+
#
|
316
|
+
def update_with_http_info(log_profile_name, log_profiles_resource, custom_headers = nil)
|
317
|
+
update_async(log_profile_name, log_profiles_resource, custom_headers).value!
|
318
|
+
end
|
319
|
+
|
320
|
+
#
|
321
|
+
# Updates an existing LogProfilesResource. To update other fields use the
|
322
|
+
# CreateOrUpdate method.
|
323
|
+
#
|
324
|
+
# @param log_profile_name [String] The name of the log profile.
|
325
|
+
# @param log_profiles_resource [LogProfileResourcePatch] Parameters supplied to
|
326
|
+
# the operation.
|
327
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
328
|
+
# to the HTTP request.
|
329
|
+
#
|
330
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
331
|
+
#
|
332
|
+
def update_async(log_profile_name, log_profiles_resource, custom_headers = nil)
|
333
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
334
|
+
fail ArgumentError, 'log_profile_name is nil' if log_profile_name.nil?
|
335
|
+
api_version = '2016-03-01'
|
336
|
+
fail ArgumentError, 'log_profiles_resource is nil' if log_profiles_resource.nil?
|
337
|
+
|
338
|
+
|
339
|
+
request_headers = {}
|
340
|
+
|
341
|
+
# Set Headers
|
342
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
343
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
344
|
+
|
345
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
346
|
+
|
347
|
+
# Serialize Request
|
348
|
+
request_mapper = Azure::ARM::Monitor::Models::LogProfileResourcePatch.mapper()
|
349
|
+
request_content = @client.serialize(request_mapper, log_profiles_resource)
|
350
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
351
|
+
|
352
|
+
path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}'
|
353
|
+
|
354
|
+
request_url = @base_url || @client.base_url
|
355
|
+
|
356
|
+
options = {
|
357
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
358
|
+
path_params: {'subscriptionId' => @client.subscription_id,'logProfileName' => log_profile_name},
|
359
|
+
query_params: {'api-version' => api_version},
|
360
|
+
body: request_content,
|
361
|
+
headers: request_headers.merge(custom_headers || {}),
|
362
|
+
base_url: request_url
|
363
|
+
}
|
364
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
365
|
+
|
366
|
+
promise = promise.then do |result|
|
367
|
+
http_response = result.response
|
368
|
+
status_code = http_response.status
|
369
|
+
response_content = http_response.body
|
370
|
+
unless status_code == 200
|
371
|
+
error_model = JSON.load(response_content)
|
372
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
373
|
+
end
|
374
|
+
|
375
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
376
|
+
# Deserialize Response
|
377
|
+
if status_code == 200
|
378
|
+
begin
|
379
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
380
|
+
result_mapper = Azure::ARM::Monitor::Models::LogProfileResource.mapper()
|
381
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
382
|
+
rescue Exception => e
|
383
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
result
|
388
|
+
end
|
389
|
+
|
390
|
+
promise.execute
|
391
|
+
end
|
392
|
+
|
393
|
+
#
|
394
|
+
# List the log profiles.
|
395
|
+
#
|
396
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
397
|
+
# will be added to the HTTP request.
|
398
|
+
#
|
399
|
+
# @return [LogProfileCollection] operation results.
|
400
|
+
#
|
401
|
+
def list(custom_headers = nil)
|
402
|
+
response = list_async(custom_headers).value!
|
403
|
+
response.body unless response.nil?
|
404
|
+
end
|
405
|
+
|
406
|
+
#
|
407
|
+
# List the log profiles.
|
408
|
+
#
|
409
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
410
|
+
# will be added to the HTTP request.
|
411
|
+
#
|
412
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
413
|
+
#
|
414
|
+
def list_with_http_info(custom_headers = nil)
|
415
|
+
list_async(custom_headers).value!
|
416
|
+
end
|
417
|
+
|
418
|
+
#
|
419
|
+
# List the log profiles.
|
420
|
+
#
|
421
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
422
|
+
# to the HTTP request.
|
423
|
+
#
|
424
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
425
|
+
#
|
426
|
+
def list_async(custom_headers = nil)
|
427
|
+
api_version = '2016-03-01'
|
428
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
429
|
+
|
430
|
+
|
431
|
+
request_headers = {}
|
432
|
+
|
433
|
+
# Set Headers
|
434
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
435
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
436
|
+
path_template = 'subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles'
|
437
|
+
|
438
|
+
request_url = @base_url || @client.base_url
|
439
|
+
|
440
|
+
options = {
|
441
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
442
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
443
|
+
query_params: {'api-version' => api_version},
|
444
|
+
headers: request_headers.merge(custom_headers || {}),
|
445
|
+
base_url: request_url
|
446
|
+
}
|
447
|
+
promise = @client.make_request_async(:get, path_template, options)
|
448
|
+
|
449
|
+
promise = promise.then do |result|
|
450
|
+
http_response = result.response
|
451
|
+
status_code = http_response.status
|
452
|
+
response_content = http_response.body
|
453
|
+
unless status_code == 200
|
454
|
+
error_model = JSON.load(response_content)
|
455
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
456
|
+
end
|
457
|
+
|
458
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
459
|
+
# Deserialize Response
|
460
|
+
if status_code == 200
|
461
|
+
begin
|
462
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
463
|
+
result_mapper = Azure::ARM::Monitor::Models::LogProfileCollection.mapper()
|
464
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
465
|
+
rescue Exception => e
|
466
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
467
|
+
end
|
468
|
+
end
|
469
|
+
|
470
|
+
result
|
471
|
+
end
|
472
|
+
|
473
|
+
promise.execute
|
474
|
+
end
|
475
|
+
|
476
|
+
end
|
477
|
+
end
|