Class: Azure::AlertsManagement::Mgmt::V2019_05_05_preview::Alerts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-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.

Parameters:

  • client

    service class for accessing basic functionality.



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

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientAlertsManagementClient (readonly)

Returns reference to the AlertsManagementClient.

Returns:



22
23
24
# File 'lib/2019-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 an alert.

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

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • new_state (AlertState)

    New state of the alert. Possible values

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Alert)

    operation results.



370
371
372
373
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 370

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.

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

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • new_state (AlertState)

    New state of the alert. Possible values

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
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
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 401

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?
  @client.api_version = '2019-05-05-preview'
  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::V2019_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 an alert.

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

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • new_state (AlertState)

    New state of the alert. Possible values

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



386
387
388
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 386

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’ 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.

Parameters:

  • target_resource (String) (defaults to: nil)

    Filter by target resource( which is full ARM

  • target_resource_type (String) (defaults to: nil)

    Filter by target resource type. Default

  • target_resource_group (String) (defaults to: nil)

    Filter by target resource group name.

  • monitor_service (MonitorService) (defaults to: nil)

    Filter by monitor service which

  • monitor_condition (MonitorCondition) (defaults to: nil)

    Filter by monitor condition which

  • severity (Severity) (defaults to: nil)

    Filter by severity. Default value is select all.

  • alert_state (AlertState) (defaults to: nil)

    Filter by state of the alert instance.

  • alert_rule (String) (defaults to: nil)

    Filter by specific alert rule. Default value is

  • smart_group_id (String) (defaults to: nil)

    Filter the alerts list by the Smart Group Id.

  • include_context (Boolean) (defaults to: nil)

    Include context which has contextual data

  • include_egress_config (Boolean) (defaults to: nil)

    Include egress config which would be

  • page_count (Integer) (defaults to: nil)

    Determines number of alerts returned per page in

  • sort_by (AlertsSortByFields) (defaults to: nil)

    Sort the query results by input field,

  • sort_order (Enum) (defaults to: nil)

    Sort the query results order in either ascending or

  • select (String) (defaults to: nil)

    This filter allows to selection of the fields(comma

  • time_range (TimeRange) (defaults to: nil)

    Filter by time range by below listed values.

  • custom_time_range (String) (defaults to: nil)

    Filter by custom time range in the format

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array<Alert>)

    operation results.



83
84
85
86
# File 'lib/2019-05-05-preview/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’ 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.

Parameters:

  • target_resource (String) (defaults to: nil)

    Filter by target resource( which is full ARM

  • target_resource_type (String) (defaults to: nil)

    Filter by target resource type. Default

  • target_resource_group (String) (defaults to: nil)

    Filter by target resource group name.

  • monitor_service (MonitorService) (defaults to: nil)

    Filter by monitor service which

  • monitor_condition (MonitorCondition) (defaults to: nil)

    Filter by monitor condition which

  • severity (Severity) (defaults to: nil)

    Filter by severity. Default value is select all.

  • alert_state (AlertState) (defaults to: nil)

    Filter by state of the alert instance.

  • alert_rule (String) (defaults to: nil)

    Filter by specific alert rule. Default value is

  • smart_group_id (String) (defaults to: nil)

    Filter the alerts list by the Smart Group Id.

  • include_context (Boolean) (defaults to: nil)

    Include context which has contextual data

  • include_egress_config (Boolean) (defaults to: nil)

    Include egress config which would be

  • page_count (Integer) (defaults to: nil)

    Determines number of alerts returned per page in

  • sort_by (AlertsSortByFields) (defaults to: nil)

    Sort the query results by input field,

  • sort_order (Enum) (defaults to: nil)

    Sort the query results order in either ascending or

  • select (String) (defaults to: nil)

    This filter allows to selection of the fields(comma

  • time_range (TimeRange) (defaults to: nil)

    Filter by time range by below listed values.

  • custom_time_range (String) (defaults to: nil)

    Filter by custom time range in the format

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertsList)

    which provide lazy access to pages of the response.



899
900
901
902
903
904
905
906
907
908
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 899

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’ 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.

Parameters:

  • target_resource (String) (defaults to: nil)

    Filter by target resource( which is full ARM

  • target_resource_type (String) (defaults to: nil)

    Filter by target resource type. Default

  • target_resource_group (String) (defaults to: nil)

    Filter by target resource group name.

  • monitor_service (MonitorService) (defaults to: nil)

    Filter by monitor service which

  • monitor_condition (MonitorCondition) (defaults to: nil)

    Filter by monitor condition which

  • severity (Severity) (defaults to: nil)

    Filter by severity. Default value is select all.

  • alert_state (AlertState) (defaults to: nil)

    Filter by state of the alert instance.

  • alert_rule (String) (defaults to: nil)

    Filter by specific alert rule. Default value is

  • smart_group_id (String) (defaults to: nil)

    Filter the alerts list by the Smart Group Id.

  • include_context (Boolean) (defaults to: nil)

    Include context which has contextual data

  • include_egress_config (Boolean) (defaults to: nil)

    Include egress config which would be

  • page_count (Integer) (defaults to: nil)

    Determines number of alerts returned per page in

  • sort_by (AlertsSortByFields) (defaults to: nil)

    Sort the query results by input field,

  • sort_order (Enum) (defaults to: nil)

    Sort the query results order in either ascending or

  • select (String) (defaults to: nil)

    This filter allows to selection of the fields(comma

  • time_range (TimeRange) (defaults to: nil)

    Filter by time range by below listed values.

  • custom_time_range (String) (defaults to: nil)

    Filter by custom time range in the format

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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-05-05-preview/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.subscription_id is nil' if @client.subscription_id.nil?
  @client.api_version = '2019-05-05-preview'


  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,'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_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 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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertsList)

    operation results.



756
757
758
759
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 756

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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 789

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_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 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.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



773
774
775
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 773

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’ 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.

Parameters:

  • target_resource (String) (defaults to: nil)

    Filter by target resource( which is full ARM

  • target_resource_type (String) (defaults to: nil)

    Filter by target resource type. Default

  • target_resource_group (String) (defaults to: nil)

    Filter by target resource group name.

  • monitor_service (MonitorService) (defaults to: nil)

    Filter by monitor service which

  • monitor_condition (MonitorCondition) (defaults to: nil)

    Filter by monitor condition which

  • severity (Severity) (defaults to: nil)

    Filter by severity. Default value is select all.

  • alert_state (AlertState) (defaults to: nil)

    Filter by state of the alert instance.

  • alert_rule (String) (defaults to: nil)

    Filter by specific alert rule. Default value is

  • smart_group_id (String) (defaults to: nil)

    Filter the alerts list by the Smart Group Id.

  • include_context (Boolean) (defaults to: nil)

    Include context which has contextual data

  • include_egress_config (Boolean) (defaults to: nil)

    Include egress config which would be

  • page_count (Integer) (defaults to: nil)

    Determines number of alerts returned per page in

  • sort_by (AlertsSortByFields) (defaults to: nil)

    Sort the query results by input field,

  • sort_order (Enum) (defaults to: nil)

    Sort the query results order in either ascending or

  • select (String) (defaults to: nil)

    This filter allows to selection of the fields(comma

  • time_range (TimeRange) (defaults to: nil)

    Filter by time range by below listed values.

  • custom_time_range (String) (defaults to: nil)

    Filter by custom time range in the format

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



147
148
149
# File 'lib/2019-05-05-preview/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

will be added to the HTTP request.

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Alert)

    operation results.



274
275
276
277
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 274

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.

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
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
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 305

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?
  @client.api_version = '2019-05-05-preview'


  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::V2019_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.

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



290
291
292
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 290

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) and alert state changes (New/Acknowledged/Closed).

will be added to the HTTP request.

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertModification)

    operation results.



466
467
468
469
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 466

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) and alert state changes (New/Acknowledged/Closed).

to the HTTP request.

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
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
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 495

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?
  @client.api_version = '2019-05-05-preview'


  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::V2019_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 an alert, which captures any monitor condition changes (Fired/Resolved) and alert state changes (New/Acknowledged/Closed).

will be added to the HTTP request.

Parameters:

  • alert_id (String)

    Unique ID of an alert instance.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



481
482
483
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 481

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 (Maximum 2 comma separated fields supported). For example, groupby=severity or 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’ 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.

Parameters:

  • groupby (AlertsSummaryGroupByFields)

    This parameter allows the result

  • include_smart_groups_count (Boolean) (defaults to: nil)

    Include count of the SmartGroups

  • target_resource (String) (defaults to: nil)

    Filter by target resource( which is full ARM

  • target_resource_type (String) (defaults to: nil)

    Filter by target resource type. Default

  • target_resource_group (String) (defaults to: nil)

    Filter by target resource group name.

  • monitor_service (MonitorService) (defaults to: nil)

    Filter by monitor service which

  • monitor_condition (MonitorCondition) (defaults to: nil)

    Filter by monitor condition which

  • severity (Severity) (defaults to: nil)

    Filter by severity. Default value is select all.

  • alert_state (AlertState) (defaults to: nil)

    Filter by state of the alert instance.

  • alert_rule (String) (defaults to: nil)

    Filter by specific alert rule. Default value is

  • time_range (TimeRange) (defaults to: nil)

    Filter by time range by below listed values.

  • custom_time_range (String) (defaults to: nil)

    Filter by custom time range in the format

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (AlertsSummary)

    operation results.



593
594
595
596
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 593

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 (Maximum 2 comma separated fields supported). For example, groupby=severity or 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’ 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.

Parameters:

  • groupby (AlertsSummaryGroupByFields)

    This parameter allows the result

  • include_smart_groups_count (Boolean) (defaults to: nil)

    Include count of the SmartGroups

  • target_resource (String) (defaults to: nil)

    Filter by target resource( which is full ARM

  • target_resource_type (String) (defaults to: nil)

    Filter by target resource type. Default

  • target_resource_group (String) (defaults to: nil)

    Filter by target resource group name.

  • monitor_service (MonitorService) (defaults to: nil)

    Filter by monitor service which

  • monitor_condition (MonitorCondition) (defaults to: nil)

    Filter by monitor condition which

  • severity (Severity) (defaults to: nil)

    Filter by severity. Default value is select all.

  • alert_state (AlertState) (defaults to: nil)

    Filter by state of the alert instance.

  • alert_rule (String) (defaults to: nil)

    Filter by specific alert rule. Default value is

  • time_range (TimeRange) (defaults to: nil)

    Filter by time range by below listed values.

  • custom_time_range (String) (defaults to: nil)

    Filter by custom time range in the format

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 690

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.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'groupby is nil' if groupby.nil?
  @client.api_version = '2019-05-05-preview'


  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: {'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_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(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 (Maximum 2 comma separated fields supported). For example, groupby=severity or 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’ 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.

Parameters:

  • groupby (AlertsSummaryGroupByFields)

    This parameter allows the result

  • include_smart_groups_count (Boolean) (defaults to: nil)

    Include count of the SmartGroups

  • target_resource (String) (defaults to: nil)

    Filter by target resource( which is full ARM

  • target_resource_type (String) (defaults to: nil)

    Filter by target resource type. Default

  • target_resource_group (String) (defaults to: nil)

    Filter by target resource group name.

  • monitor_service (MonitorService) (defaults to: nil)

    Filter by monitor service which

  • monitor_condition (MonitorCondition) (defaults to: nil)

    Filter by monitor condition which

  • severity (Severity) (defaults to: nil)

    Filter by severity. Default value is select all.

  • alert_state (AlertState) (defaults to: nil)

    Filter by state of the alert instance.

  • alert_rule (String) (defaults to: nil)

    Filter by specific alert rule. Default value is

  • time_range (TimeRange) (defaults to: nil)

    Filter by time range by below listed values.

  • custom_time_range (String) (defaults to: nil)

    Filter by custom time range in the format

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



642
643
644
# File 'lib/2019-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb', line 642

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