Class: Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Alerts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb

Overview

AlertsManagement Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Alerts

Creates and initializes a new instance of the Alerts class.



17
18
19
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientAlertsManagementClient (readonly)



22
23
24
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 22

def client
  @client
end

Instance Method Details

#change_state(alert_id, new_state, custom_headers: nil) ⇒ Alert

Change the state of the alert.

‘New’, ‘Acknowledged’, ‘Closed’ will be added to the HTTP request.



295
296
297
298
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 295

def change_state(alert_id, new_state, custom_headers:nil)
  response = change_state_async(alert_id, new_state, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#change_state_async(alert_id, new_state, custom_headers: nil) ⇒ Concurrent::Promise

Change the state of the alert.

‘New’, ‘Acknowledged’, ‘Closed’ to the HTTP request.



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 326

def change_state_async(alert_id, new_state, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'alert_id is nil' if alert_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'new_state is nil' if new_state.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}/changestate'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'alertId' => alert_id},
      query_params: {'api-version' => @client.api_version,'newState' => new_state},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::Alert.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#change_state_with_http_info(alert_id, new_state, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Change the state of the alert.

‘New’, ‘Acknowledged’, ‘Closed’ will be added to the HTTP request.



311
312
313
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 311

def change_state_with_http_info(alert_id, new_state, custom_headers:nil)
  change_state_async(alert_id, new_state, custom_headers:custom_headers).value!
end

#get_all(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, alert_state: nil, smart_group_id: nil, include_payload: nil, page_count: nil, sort_by: nil, sort_order: nil, time_range: nil, custom_headers: nil) ⇒ Array<Alert>

List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.

is the state of the alert at monitor service. Possible values include: ‘Fired’, ‘Resolved’ ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ ‘New’, ‘Acknowledged’, ‘Closed’ is ‘false’. default value is ‘lastModifiedDateTime’. Possible values include: ‘name’, ‘severity’, ‘alertState’, ‘monitorCondition’, ‘targetResource’, ‘targetResourceName’, ‘targetResourceGroup’, ‘targetResourceType’, ‘startDateTime’, ‘lastModifiedDateTime’ descending, default value is ‘desc’ for time fields and ‘asc’ for others. Possible values include: ‘asc’, ‘desc’ Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ will be added to the HTTP request.



58
59
60
61
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 58

def get_all(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil)
  first_page = get_all_as_lazy(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, smart_group_id:smart_group_id, include_payload:include_payload, page_count:page_count, sort_by:sort_by, sort_order:sort_order, time_range:time_range, custom_headers:custom_headers)
  first_page.get_all_items
end

#get_all_as_lazy(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, alert_state: nil, smart_group_id: nil, include_payload: nil, page_count: nil, sort_by: nil, sort_order: nil, time_range: nil, custom_headers: nil) ⇒ AlertsList

List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.

is the state of the alert at monitor service. Possible values include: ‘Fired’, ‘Resolved’ ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ ‘New’, ‘Acknowledged’, ‘Closed’ is ‘false’. default value is ‘lastModifiedDateTime’. Possible values include: ‘name’, ‘severity’, ‘alertState’, ‘monitorCondition’, ‘targetResource’, ‘targetResourceName’, ‘targetResourceGroup’, ‘targetResourceType’, ‘startDateTime’, ‘lastModifiedDateTime’ descending, default value is ‘desc’ for time fields and ‘asc’ for others. Possible values include: ‘asc’, ‘desc’ Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ will be added to the HTTP request.



696
697
698
699
700
701
702
703
704
705
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 696

def get_all_as_lazy(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil)
  response = get_all_async(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, smart_group_id:smart_group_id, include_payload:include_payload, page_count:page_count, sort_by:sort_by, sort_order:sort_order, time_range:time_range, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      get_all_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#get_all_async(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, alert_state: nil, smart_group_id: nil, include_payload: nil, page_count: nil, sort_by: nil, sort_order: nil, time_range: nil, custom_headers: nil) ⇒ Concurrent::Promise

List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.

is the state of the alert at monitor service. Possible values include: ‘Fired’, ‘Resolved’ ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ ‘New’, ‘Acknowledged’, ‘Closed’ is ‘false’. default value is ‘lastModifiedDateTime’. Possible values include: ‘name’, ‘severity’, ‘alertState’, ‘monitorCondition’, ‘targetResource’, ‘targetResourceName’, ‘targetResourceGroup’, ‘targetResourceType’, ‘startDateTime’, ‘lastModifiedDateTime’ descending, default value is ‘desc’ for time fields and ‘asc’ for others. Possible values include: ‘asc’, ‘desc’ Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ to the HTTP request.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 135

def get_all_async(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'targetResource' => target_resource,'targetResourceGroup' => target_resource_group,'targetResourceType' => target_resource_type,'monitorService' => @client.monitor_service,'monitorCondition' => monitor_condition,'severity' => severity,'alertState' => alert_state,'smartGroupId' => smart_group_id,'includePayload' => include_payload,'pageCount' => page_count,'sortBy' => sort_by,'sortOrder' => sort_order,'timeRange' => time_range,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertsList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_all_next(next_page_link, custom_headers: nil) ⇒ AlertsList

List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.

to List operation. will be added to the HTTP request.



578
579
580
581
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 578

def get_all_next(next_page_link, custom_headers:nil)
  response = get_all_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_all_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.

to List operation. to the HTTP request.



611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 611

def get_all_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertsList.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_all_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.

to List operation. will be added to the HTTP request.



595
596
597
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 595

def get_all_next_with_http_info(next_page_link, custom_headers:nil)
  get_all_next_async(next_page_link, custom_headers:custom_headers).value!
end

#get_all_with_http_info(target_resource: nil, target_resource_group: nil, target_resource_type: nil, monitor_condition: nil, severity: nil, alert_state: nil, smart_group_id: nil, include_payload: nil, page_count: nil, sort_by: nil, sort_order: nil, time_range: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.

is the state of the alert at monitor service. Possible values include: ‘Fired’, ‘Resolved’ ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ ‘New’, ‘Acknowledged’, ‘Closed’ is ‘false’. default value is ‘lastModifiedDateTime’. Possible values include: ‘name’, ‘severity’, ‘alertState’, ‘monitorCondition’, ‘targetResource’, ‘targetResourceName’, ‘targetResourceGroup’, ‘targetResourceType’, ‘startDateTime’, ‘lastModifiedDateTime’ descending, default value is ‘desc’ for time fields and ‘asc’ for others. Possible values include: ‘asc’, ‘desc’ Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ will be added to the HTTP request.



97
98
99
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 97

def get_all_with_http_info(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil)
  get_all_async(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, smart_group_id:smart_group_id, include_payload:include_payload, page_count:page_count, sort_by:sort_by, sort_order:sort_order, time_range:time_range, custom_headers:custom_headers).value!
end

#get_by_id(alert_id, custom_headers: nil) ⇒ Alert

Get a specific alert.

Get information related to a specific alert

will be added to the HTTP request.



199
200
201
202
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 199

def get_by_id(alert_id, custom_headers:nil)
  response = get_by_id_async(alert_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_by_id_async(alert_id, custom_headers: nil) ⇒ Concurrent::Promise

Get a specific alert.

Get information related to a specific alert

to the HTTP request.



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 230

def get_by_id_async(alert_id, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'alert_id is nil' if alert_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'alertId' => alert_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::Alert.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_by_id_with_http_info(alert_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get a specific alert.

Get information related to a specific alert

will be added to the HTTP request.



215
216
217
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 215

def get_by_id_with_http_info(alert_id, custom_headers:nil)
  get_by_id_async(alert_id, custom_headers:custom_headers).value!
end

#get_history(alert_id, custom_headers: nil) ⇒ AlertModification

Get the history of the changes of an alert.

will be added to the HTTP request.



390
391
392
393
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 390

def get_history(alert_id, custom_headers:nil)
  response = get_history_async(alert_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_history_async(alert_id, custom_headers: nil) ⇒ Concurrent::Promise

Get the history of the changes of an alert.

to the HTTP request.



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 417

def get_history_async(alert_id, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'alert_id is nil' if alert_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}/history'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'alertId' => alert_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertModification.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_history_with_http_info(alert_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get the history of the changes of an alert.

will be added to the HTTP request.



404
405
406
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 404

def get_history_with_http_info(alert_id, custom_headers:nil)
  get_history_async(alert_id, custom_headers:custom_headers).value!
end

#get_summary(target_resource_group: nil, time_range: nil, custom_headers: nil) ⇒ AlertsSummary

Summary of alerts with the count each severity.

Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ will be added to the HTTP request.



482
483
484
485
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 482

def get_summary(target_resource_group:nil, time_range:nil, custom_headers:nil)
  response = get_summary_async(target_resource_group:target_resource_group, time_range:time_range, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_summary_async(target_resource_group: nil, time_range: nil, custom_headers: nil) ⇒ Concurrent::Promise

Summary of alerts with the count each severity.

Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ to the HTTP request.



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 513

def get_summary_async(target_resource_group:nil, time_range:nil, custom_headers:nil)
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'targetResourceGroup' => target_resource_group,'timeRange' => time_range,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertsSummary.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_summary_with_http_info(target_resource_group: nil, time_range: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Summary of alerts with the count each severity.

Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ will be added to the HTTP request.



498
499
500
# File 'lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 498

def get_summary_with_http_info(target_resource_group:nil, time_range:nil, custom_headers:nil)
  get_summary_async(target_resource_group:target_resource_group, time_range:time_range, custom_headers:custom_headers).value!
end