Class: Azure::AlertsManagement::Mgmt::V2019_03_01::Alerts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-03-01/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/2019-03-01/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/2019-03-01/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 an alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to change state of this particular alert then use parent resource of scope. So in this example change state call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId’.

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



399
400
401
402
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 399

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 an alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to change state of this particular alert then use parent resource of scope. So in this example change state call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId’.

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



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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 444

def change_state_async(alert_id, new_state, custom_headers:nil)
  fail ArgumentError, '@client.scope is nil' if @client.scope.nil?
  fail ArgumentError, 'alert_id is nil' if alert_id.nil?
  @client.api_version = '2018-05-05'
  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 = '{scope}/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: {'alertId' => alert_id},
      skip_encoding_path_params: {'scope' => @client.scope},
      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::V2019_03_01::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 an alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to change state of this particular alert then use parent resource of scope. So in this example change state call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId’.

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



422
423
424
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 422

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_type: nil, target_resource_group: nil, monitor_service: nil, monitor_condition: nil, severity: nil, alert_state: nil, alert_rule: nil, smart_group_id: nil, include_context: nil, include_egress_config: nil, page_count: nil, sort_by: nil, sort_order: nil, select: nil, time_range: nil, custom_time_range: nil, custom_headers: nil) ⇒ Array<Alert>

List all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.

ID) Default value is select all. value is select all. Default value is select all. generates the alert instance. Default value is select all. Possible values include: ‘Application Insights’, ‘ActivityLog Administrative’, ‘ActivityLog Security’, ‘ActivityLog Recommendation’, ‘ActivityLog Policy’, ‘ActivityLog Autoscale’, ‘Log Analytics’, ‘Nagios’, ‘Platform’, ‘SCOM’, ‘ServiceHealth’, ‘SmartDetector’, ‘VM Insights’, ‘Zabbix’, ‘Resource Health’ is either ‘Fired’ or ‘Resolved’. Default value is to select all. Possible values include: ‘Fired’, ‘Resolved’ Possible values include: ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ Default value is to select all. Possible values include: ‘New’, ‘Acknowledged’, ‘Closed’ to select all. Default value is none. specific to the monitor service. Default value is false’ used for displaying the content in portal. Default value is ‘false’. response. Permissible value is between 1 to 250. When the “includeContent” filter is selected, maximum value allowed is 25. Default value is 25. 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’ separated) which would be part of the essential section. This would allow to project only the required fields rather than getting entire content. Default is to fetch all the fields in the essentials section. Default value is 1 day. Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ <start-time>/<end-time> where time is in (ISO-8601 format)‘. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. will be added to the HTTP request.



83
84
85
86
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 83

def get_all(target_resource:nil, target_resource_type:nil, target_resource_group:nil, monitor_service:nil, monitor_condition:nil, severity:nil, alert_state:nil, alert_rule:nil, smart_group_id:nil, include_context:nil, include_egress_config:nil, page_count:nil, sort_by:nil, sort_order:nil, select:nil, time_range:nil, custom_time_range:nil, custom_headers:nil)
  first_page = get_all_as_lazy(target_resource:target_resource, target_resource_type:target_resource_type, target_resource_group:target_resource_group, monitor_service:monitor_service, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, alert_rule:alert_rule, smart_group_id:smart_group_id, include_context:include_context, include_egress_config:include_egress_config, page_count:page_count, sort_by:sort_by, sort_order:sort_order, select:select, time_range:time_range, custom_time_range:custom_time_range, custom_headers:custom_headers)
  first_page.get_all_items
end

#get_all_as_lazy(target_resource: nil, target_resource_type: nil, target_resource_group: nil, monitor_service: nil, monitor_condition: nil, severity: nil, alert_state: nil, alert_rule: nil, smart_group_id: nil, include_context: nil, include_egress_config: nil, page_count: nil, sort_by: nil, sort_order: nil, select: nil, time_range: nil, custom_time_range: nil, custom_headers: nil) ⇒ AlertsList

List all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.

ID) Default value is select all. value is select all. Default value is select all. generates the alert instance. Default value is select all. Possible values include: ‘Application Insights’, ‘ActivityLog Administrative’, ‘ActivityLog Security’, ‘ActivityLog Recommendation’, ‘ActivityLog Policy’, ‘ActivityLog Autoscale’, ‘Log Analytics’, ‘Nagios’, ‘Platform’, ‘SCOM’, ‘ServiceHealth’, ‘SmartDetector’, ‘VM Insights’, ‘Zabbix’, ‘Resource Health’ is either ‘Fired’ or ‘Resolved’. Default value is to select all. Possible values include: ‘Fired’, ‘Resolved’ Possible values include: ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ Default value is to select all. Possible values include: ‘New’, ‘Acknowledged’, ‘Closed’ to select all. Default value is none. specific to the monitor service. Default value is false’ used for displaying the content in portal. Default value is ‘false’. response. Permissible value is between 1 to 250. When the “includeContent” filter is selected, maximum value allowed is 25. Default value is 25. 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’ separated) which would be part of the essential section. This would allow to project only the required fields rather than getting entire content. Default is to fetch all the fields in the essentials section. Default value is 1 day. Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ <start-time>/<end-time> where time is in (ISO-8601 format)‘. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. will be added to the HTTP request.



965
966
967
968
969
970
971
972
973
974
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 965

def get_all_as_lazy(target_resource:nil, target_resource_type:nil, target_resource_group:nil, monitor_service:nil, monitor_condition:nil, severity:nil, alert_state:nil, alert_rule:nil, smart_group_id:nil, include_context:nil, include_egress_config:nil, page_count:nil, sort_by:nil, sort_order:nil, select:nil, time_range:nil, custom_time_range:nil, custom_headers:nil)
  response = get_all_async(target_resource:target_resource, target_resource_type:target_resource_type, target_resource_group:target_resource_group, monitor_service:monitor_service, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, alert_rule:alert_rule, smart_group_id:smart_group_id, include_context:include_context, include_egress_config:include_egress_config, page_count:page_count, sort_by:sort_by, sort_order:sort_order, select:select, time_range:time_range, custom_time_range:custom_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_type: nil, target_resource_group: nil, monitor_service: nil, monitor_condition: nil, severity: nil, alert_state: nil, alert_rule: nil, smart_group_id: nil, include_context: nil, include_egress_config: nil, page_count: nil, sort_by: nil, sort_order: nil, select: nil, time_range: nil, custom_time_range: nil, custom_headers: nil) ⇒ Concurrent::Promise

List all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.

ID) Default value is select all. value is select all. Default value is select all. generates the alert instance. Default value is select all. Possible values include: ‘Application Insights’, ‘ActivityLog Administrative’, ‘ActivityLog Security’, ‘ActivityLog Recommendation’, ‘ActivityLog Policy’, ‘ActivityLog Autoscale’, ‘Log Analytics’, ‘Nagios’, ‘Platform’, ‘SCOM’, ‘ServiceHealth’, ‘SmartDetector’, ‘VM Insights’, ‘Zabbix’, ‘Resource Health’ is either ‘Fired’ or ‘Resolved’. Default value is to select all. Possible values include: ‘Fired’, ‘Resolved’ Possible values include: ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ Default value is to select all. Possible values include: ‘New’, ‘Acknowledged’, ‘Closed’ to select all. Default value is none. specific to the monitor service. Default value is false’ used for displaying the content in portal. Default value is ‘false’. response. Permissible value is between 1 to 250. When the “includeContent” filter is selected, maximum value allowed is 25. Default value is 25. 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’ separated) which would be part of the essential section. This would allow to project only the required fields rather than getting entire content. Default is to fetch all the fields in the essentials section. Default value is 1 day. Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ <start-time>/<end-time> where time is in (ISO-8601 format)‘. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. to the HTTP request.



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 210

def get_all_async(target_resource:nil, target_resource_type:nil, target_resource_group:nil, monitor_service:nil, monitor_condition:nil, severity:nil, alert_state:nil, alert_rule:nil, smart_group_id:nil, include_context:nil, include_egress_config:nil, page_count:nil, sort_by:nil, sort_order:nil, select:nil, time_range:nil, custom_time_range:nil, custom_headers:nil)
  fail ArgumentError, '@client.scope is nil' if @client.scope.nil?
  @client.api_version = '2018-05-05'


  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 = '{scope}/providers/Microsoft.AlertsManagement/alerts'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'scope' => @client.scope},
      query_params: {'targetResource' => target_resource,'targetResourceType' => target_resource_type,'targetResourceGroup' => target_resource_group,'monitorService' => monitor_service,'monitorCondition' => monitor_condition,'severity' => severity,'alertState' => alert_state,'alertRule' => alert_rule,'smartGroupId' => smart_group_id,'includeContext' => include_context,'includeEgressConfig' => include_egress_config,'pageCount' => page_count,'sortBy' => sort_by,'sortOrder' => sort_order,'select' => select,'timeRange' => time_range,'customTimeRange' => custom_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::V2019_03_01::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 existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.

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



822
823
824
825
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 822

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 existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.

to List operation. to the HTTP request.



855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 855

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::V2019_03_01::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 existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.

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



839
840
841
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 839

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_type: nil, target_resource_group: nil, monitor_service: nil, monitor_condition: nil, severity: nil, alert_state: nil, alert_rule: nil, smart_group_id: nil, include_context: nil, include_egress_config: nil, page_count: nil, sort_by: nil, sort_order: nil, select: nil, time_range: nil, custom_time_range: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.

ID) Default value is select all. value is select all. Default value is select all. generates the alert instance. Default value is select all. Possible values include: ‘Application Insights’, ‘ActivityLog Administrative’, ‘ActivityLog Security’, ‘ActivityLog Recommendation’, ‘ActivityLog Policy’, ‘ActivityLog Autoscale’, ‘Log Analytics’, ‘Nagios’, ‘Platform’, ‘SCOM’, ‘ServiceHealth’, ‘SmartDetector’, ‘VM Insights’, ‘Zabbix’, ‘Resource Health’ is either ‘Fired’ or ‘Resolved’. Default value is to select all. Possible values include: ‘Fired’, ‘Resolved’ Possible values include: ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ Default value is to select all. Possible values include: ‘New’, ‘Acknowledged’, ‘Closed’ to select all. Default value is none. specific to the monitor service. Default value is false’ used for displaying the content in portal. Default value is ‘false’. response. Permissible value is between 1 to 250. When the “includeContent” filter is selected, maximum value allowed is 25. Default value is 25. 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’ separated) which would be part of the essential section. This would allow to project only the required fields rather than getting entire content. Default is to fetch all the fields in the essentials section. Default value is 1 day. Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ <start-time>/<end-time> where time is in (ISO-8601 format)‘. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. will be added to the HTTP request.



147
148
149
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 147

def get_all_with_http_info(target_resource:nil, target_resource_type:nil, target_resource_group:nil, monitor_service:nil, monitor_condition:nil, severity:nil, alert_state:nil, alert_rule:nil, smart_group_id:nil, include_context:nil, include_egress_config:nil, page_count:nil, sort_by:nil, sort_order:nil, select:nil, time_range:nil, custom_time_range:nil, custom_headers:nil)
  get_all_async(target_resource:target_resource, target_resource_type:target_resource_type, target_resource_group:target_resource_group, monitor_service:monitor_service, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, alert_rule:alert_rule, smart_group_id:smart_group_id, include_context:include_context, include_egress_config:include_egress_config, page_count:page_count, sort_by:sort_by, sort_order:sort_order, select:select, time_range:time_range, custom_time_range:custom_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. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to get alert by id then use parent resource of scope. So in this example get alert by id call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId’.

will be added to the HTTP request.



281
282
283
284
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 281

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. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to get alert by id then use parent resource of scope. So in this example get alert by id call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId’.

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/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 326

def get_by_id_async(alert_id, custom_headers:nil)
  fail ArgumentError, '@client.scope is nil' if @client.scope.nil?
  fail ArgumentError, 'alert_id is nil' if alert_id.nil?
  @client.api_version = '2018-05-05'


  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 = '{scope}/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: {'alertId' => alert_id},
      skip_encoding_path_params: {'scope' => @client.scope},
      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::V2019_03_01::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. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to get alert by id then use parent resource of scope. So in this example get alert by id call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId’.

will be added to the HTTP request.



304
305
306
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 304

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 an alert, which captures any monitor condition changes (Fired/Resolved), alert state changes (New/Acknowledged/Closed) and applied action rules for that particular alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to get history of this particular alert then use parent resource of scope. So in this example get history call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId/history’.

will be added to the HTTP request.



518
519
520
521
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 518

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 an alert, which captures any monitor condition changes (Fired/Resolved), alert state changes (New/Acknowledged/Closed) and applied action rules for that particular alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to get history of this particular alert then use parent resource of scope. So in this example get history call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId/history’.

to the HTTP request.



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 563

def get_history_async(alert_id, custom_headers:nil)
  fail ArgumentError, '@client.scope is nil' if @client.scope.nil?
  fail ArgumentError, 'alert_id is nil' if alert_id.nil?
  @client.api_version = '2018-05-05'


  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 = '{scope}/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: {'alertId' => alert_id},
      skip_encoding_path_params: {'scope' => @client.scope},
      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::V2019_03_01::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 an alert, which captures any monitor condition changes (Fired/Resolved), alert state changes (New/Acknowledged/Closed) and applied action rules for that particular alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/alertId’ and ‘vm1’ is deleted then if you want to get history of this particular alert then use parent resource of scope. So in this example get history call will look like this: ‘/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.AlertsManagement/alerts/alertId/history’.

will be added to the HTTP request.



541
542
543
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 541

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

#get_summary(groupby, include_smart_groups_count: nil, target_resource: nil, target_resource_type: nil, target_resource_group: nil, monitor_service: nil, monitor_condition: nil, severity: nil, alert_state: nil, alert_rule: nil, time_range: nil, custom_time_range: nil, custom_headers: nil) ⇒ AlertsSummary

Get a summarized count of your alerts grouped by various parameters (e.g. grouping by ‘Severity’ returns the count of alerts for each severity).

set to be grouped by input fields. For example, groupby=severity,alertstate. Possible values include: ‘severity’, ‘alertState’, ‘monitorCondition’, ‘monitorService’, ‘signalType’, ‘alertRule’ as part of the summary. Default value is ‘false’. ID) Default value is select all. value is select all. Default value is select all. generates the alert instance. Default value is select all. Possible values include: ‘Application Insights’, ‘ActivityLog Administrative’, ‘ActivityLog Security’, ‘ActivityLog Recommendation’, ‘ActivityLog Policy’, ‘ActivityLog Autoscale’, ‘Log Analytics’, ‘Nagios’, ‘Platform’, ‘SCOM’, ‘ServiceHealth’, ‘SmartDetector’, ‘VM Insights’, ‘Zabbix’, ‘Resource Health’ is either ‘Fired’ or ‘Resolved’. Default value is to select all. Possible values include: ‘Fired’, ‘Resolved’ Possible values include: ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ Default value is to select all. Possible values include: ‘New’, ‘Acknowledged’, ‘Closed’ to select all. Default value is 1 day. Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ <start-time>/<end-time> where time is in (ISO-8601 format)‘. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. will be added to the HTTP request.



661
662
663
664
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 661

def get_summary(groupby, include_smart_groups_count:nil, target_resource:nil, target_resource_type:nil, target_resource_group:nil, monitor_service:nil, monitor_condition:nil, severity:nil, alert_state:nil, alert_rule:nil, time_range:nil, custom_time_range:nil, custom_headers:nil)
  response = get_summary_async(groupby, include_smart_groups_count:include_smart_groups_count, target_resource:target_resource, target_resource_type:target_resource_type, target_resource_group:target_resource_group, monitor_service:monitor_service, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, alert_rule:alert_rule, time_range:time_range, custom_time_range:custom_time_range, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_summary_async(groupby, include_smart_groups_count: nil, target_resource: nil, target_resource_type: nil, target_resource_group: nil, monitor_service: nil, monitor_condition: nil, severity: nil, alert_state: nil, alert_rule: nil, time_range: nil, custom_time_range: nil, custom_headers: nil) ⇒ Concurrent::Promise

Get a summarized count of your alerts grouped by various parameters (e.g. grouping by ‘Severity’ returns the count of alerts for each severity).

set to be grouped by input fields. For example, groupby=severity,alertstate. Possible values include: ‘severity’, ‘alertState’, ‘monitorCondition’, ‘monitorService’, ‘signalType’, ‘alertRule’ as part of the summary. Default value is ‘false’. ID) Default value is select all. value is select all. Default value is select all. generates the alert instance. Default value is select all. Possible values include: ‘Application Insights’, ‘ActivityLog Administrative’, ‘ActivityLog Security’, ‘ActivityLog Recommendation’, ‘ActivityLog Policy’, ‘ActivityLog Autoscale’, ‘Log Analytics’, ‘Nagios’, ‘Platform’, ‘SCOM’, ‘ServiceHealth’, ‘SmartDetector’, ‘VM Insights’, ‘Zabbix’, ‘Resource Health’ is either ‘Fired’ or ‘Resolved’. Default value is to select all. Possible values include: ‘Fired’, ‘Resolved’ Possible values include: ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ Default value is to select all. Possible values include: ‘New’, ‘Acknowledged’, ‘Closed’ to select all. Default value is 1 day. Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ <start-time>/<end-time> where time is in (ISO-8601 format)‘. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. to the HTTP request.



756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 756

def get_summary_async(groupby, include_smart_groups_count:nil, target_resource:nil, target_resource_type:nil, target_resource_group:nil, monitor_service:nil, monitor_condition:nil, severity:nil, alert_state:nil, alert_rule:nil, time_range:nil, custom_time_range:nil, custom_headers:nil)
  fail ArgumentError, '@client.scope is nil' if @client.scope.nil?
  fail ArgumentError, 'groupby is nil' if groupby.nil?
  @client.api_version = '2018-05-05'


  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 = '{scope}/providers/Microsoft.AlertsManagement/alertsSummary'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'scope' => @client.scope},
      query_params: {'groupby' => groupby,'includeSmartGroupsCount' => include_smart_groups_count,'targetResource' => target_resource,'targetResourceType' => target_resource_type,'targetResourceGroup' => target_resource_group,'monitorService' => monitor_service,'monitorCondition' => monitor_condition,'severity' => severity,'alertState' => alert_state,'alertRule' => alert_rule,'timeRange' => time_range,'customTimeRange' => custom_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::V2019_03_01::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(groupby, include_smart_groups_count: nil, target_resource: nil, target_resource_type: nil, target_resource_group: nil, monitor_service: nil, monitor_condition: nil, severity: nil, alert_state: nil, alert_rule: nil, time_range: nil, custom_time_range: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get a summarized count of your alerts grouped by various parameters (e.g. grouping by ‘Severity’ returns the count of alerts for each severity).

set to be grouped by input fields. For example, groupby=severity,alertstate. Possible values include: ‘severity’, ‘alertState’, ‘monitorCondition’, ‘monitorService’, ‘signalType’, ‘alertRule’ as part of the summary. Default value is ‘false’. ID) Default value is select all. value is select all. Default value is select all. generates the alert instance. Default value is select all. Possible values include: ‘Application Insights’, ‘ActivityLog Administrative’, ‘ActivityLog Security’, ‘ActivityLog Recommendation’, ‘ActivityLog Policy’, ‘ActivityLog Autoscale’, ‘Log Analytics’, ‘Nagios’, ‘Platform’, ‘SCOM’, ‘ServiceHealth’, ‘SmartDetector’, ‘VM Insights’, ‘Zabbix’, ‘Resource Health’ is either ‘Fired’ or ‘Resolved’. Default value is to select all. Possible values include: ‘Fired’, ‘Resolved’ Possible values include: ‘Sev0’, ‘Sev1’, ‘Sev2’, ‘Sev3’, ‘Sev4’ Default value is to select all. Possible values include: ‘New’, ‘Acknowledged’, ‘Closed’ to select all. Default value is 1 day. Possible values include: ‘1h’, ‘1d’, ‘7d’, ‘30d’ <start-time>/<end-time> where time is in (ISO-8601 format)‘. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. will be added to the HTTP request.



709
710
711
# File 'lib/2019-03-01/generated/azure_mgmt_alerts_management/alerts.rb', line 709

def get_summary_with_http_info(groupby, include_smart_groups_count:nil, target_resource:nil, target_resource_type:nil, target_resource_group:nil, monitor_service:nil, monitor_condition:nil, severity:nil, alert_state:nil, alert_rule:nil, time_range:nil, custom_time_range:nil, custom_headers:nil)
  get_summary_async(groupby, include_smart_groups_count:include_smart_groups_count, target_resource:target_resource, target_resource_type:target_resource_type, target_resource_group:target_resource_group, monitor_service:monitor_service, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, alert_rule:alert_rule, time_range:time_range, custom_time_range:custom_time_range, custom_headers:custom_headers).value!
end