class Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Alerts
AlertsManagement
Client
Attributes
@return [AlertsManagementClient] reference to the AlertsManagementClient
Public Class Methods
Creates and initializes a new instance of the Alerts
class. @param client service class for accessing basic functionality.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 17 def initialize(client) @client = client end
Public Instance Methods
Change the state of the alert.
@param alert_id [String] Unique ID of an alert object. @param new_state [AlertState] filter by state. Possible values include: 'New', 'Acknowledged', 'Closed' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Alert] operation results.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 295 def change_state(alert_id, new_state, custom_headers:nil) response = change_state_async(alert_id, new_state, custom_headers:custom_headers).value! response.body unless response.nil? end
Change the state of the alert.
@param alert_id [String] Unique ID of an alert object. @param new_state [AlertState] filter by state. Possible values include: 'New', 'Acknowledged', 'Closed' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 326 def change_state_async(alert_id, new_state, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'alert_id is nil' if alert_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? fail ArgumentError, 'new_state is nil' if new_state.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}/changestate' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'alertId' => alert_id}, query_params: {'api-version' => @client.api_version,'newState' => new_state}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::Alert.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Change the state of the alert.
@param alert_id [String] Unique ID of an alert object. @param new_state [AlertState] filter by state. Possible values include: 'New', 'Acknowledged', 'Closed' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 311 def change_state_with_http_info(alert_id, new_state, custom_headers:nil) change_state_async(alert_id, new_state, custom_headers:custom_headers).value! end
List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.
@param target_resource [String] filter by target resource @param target_resource_group [String] filter by target resource group name @param target_resource_type [String] filter by target resource type @param monitor_condition [MonitorCondition] filter by monitor condition which is the state of the alert at monitor service. Possible values include: 'Fired', 'Resolved' @param severity [Severity] filter by severity. Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' @param alert_state [AlertState] filter by state. Possible values include: 'New', 'Acknowledged', 'Closed' @param smart_group_id [String] filter by smart Group Id @param include_payload [Boolean] include payload field content, default value is 'false'. @param page_count [Integer] number of items per page, default value is '25'. @param sort_by [AlertsSortByFields] sort the query results by input field, default value is 'lastModifiedDateTime'. Possible values include: 'name', 'severity', 'alertState', 'monitorCondition', 'targetResource', 'targetResourceName', 'targetResourceGroup', 'targetResourceType', 'startDateTime', 'lastModifiedDateTime' @param sort_order [Enum] sort the query results order in either ascending or descending, default value is 'desc' for time fields and 'asc' for others. Possible values include: 'asc', 'desc' @param time_range [TimeRange] filter by time range, default value is 1 day. Possible values include: '1h', '1d', '7d', '30d' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array<Alert>] operation results.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 58 def get_all(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil) first_page = get_all_as_lazy(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, smart_group_id:smart_group_id, include_payload:include_payload, page_count:page_count, sort_by:sort_by, sort_order:sort_order, time_range:time_range, custom_headers:custom_headers) first_page.get_all_items end
List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.
@param target_resource [String] filter by target resource @param target_resource_group [String] filter by target resource group name @param target_resource_type [String] filter by target resource type @param monitor_condition [MonitorCondition] filter by monitor condition which is the state of the alert at monitor service. Possible values include: 'Fired', 'Resolved' @param severity [Severity] filter by severity. Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' @param alert_state [AlertState] filter by state. Possible values include: 'New', 'Acknowledged', 'Closed' @param smart_group_id [String] filter by smart Group Id @param include_payload [Boolean] include payload field content, default value is 'false'. @param page_count [Integer] number of items per page, default value is '25'. @param sort_by [AlertsSortByFields] sort the query results by input field, default value is 'lastModifiedDateTime'. Possible values include: 'name', 'severity', 'alertState', 'monitorCondition', 'targetResource', 'targetResourceName', 'targetResourceGroup', 'targetResourceType', 'startDateTime', 'lastModifiedDateTime' @param sort_order [Enum] sort the query results order in either ascending or descending, default value is 'desc' for time fields and 'asc' for others. Possible values include: 'asc', 'desc' @param time_range [TimeRange] filter by time range, default value is 1 day. Possible values include: '1h', '1d', '7d', '30d' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [AlertsList] which provide lazy access to pages of the response.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 696 def get_all_as_lazy(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil) response = get_all_async(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, smart_group_id:smart_group_id, include_payload:include_payload, page_count:page_count, sort_by:sort_by, sort_order:sort_order, time_range:time_range, custom_headers:custom_headers).value! unless response.nil? page = response.body page.next_method = Proc.new do |next_page_link| get_all_next_async(next_page_link, custom_headers:custom_headers) end page end end
List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.
@param target_resource [String] filter by target resource @param target_resource_group [String] filter by target resource group name @param target_resource_type [String] filter by target resource type @param monitor_condition [MonitorCondition] filter by monitor condition which is the state of the alert at monitor service. Possible values include: 'Fired', 'Resolved' @param severity [Severity] filter by severity. Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' @param alert_state [AlertState] filter by state. Possible values include: 'New', 'Acknowledged', 'Closed' @param smart_group_id [String] filter by smart Group Id @param include_payload [Boolean] include payload field content, default value is 'false'. @param page_count [Integer] number of items per page, default value is '25'. @param sort_by [AlertsSortByFields] sort the query results by input field, default value is 'lastModifiedDateTime'. Possible values include: 'name', 'severity', 'alertState', 'monitorCondition', 'targetResource', 'targetResourceName', 'targetResourceGroup', 'targetResourceType', 'startDateTime', 'lastModifiedDateTime' @param sort_order [Enum] sort the query results order in either ascending or descending, default value is 'desc' for time fields and 'asc' for others. Possible values include: 'asc', 'desc' @param time_range [TimeRange] filter by time range, default value is 1 day. Possible values include: '1h', '1d', '7d', '30d' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 135 def get_all_async(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id}, query_params: {'targetResource' => target_resource,'targetResourceGroup' => target_resource_group,'targetResourceType' => target_resource_type,'monitorService' => @client.monitor_service,'monitorCondition' => monitor_condition,'severity' => severity,'alertState' => alert_state,'smartGroupId' => smart_group_id,'includePayload' => include_payload,'pageCount' => page_count,'sortBy' => sort_by,'sortOrder' => sort_order,'timeRange' => time_range,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertsList.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [AlertsList] operation results.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 578 def get_all_next(next_page_link, custom_headers:nil) response = get_all_next_async(next_page_link, custom_headers:custom_headers).value! response.body unless response.nil? end
List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 611 def get_all_next_async(next_page_link, custom_headers:nil) fail ArgumentError, 'next_page_link is nil' if next_page_link.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = '{nextLink}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], skip_encoding_path_params: {'nextLink' => next_page_link}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertsList.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.
@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 595 def get_all_next_with_http_info(next_page_link, custom_headers:nil) get_all_next_async(next_page_link, custom_headers:custom_headers).value! end
List all the existing alerts, where the results can be selective by passing multiple filter parameters including time range and sorted on specific fields.
@param target_resource [String] filter by target resource @param target_resource_group [String] filter by target resource group name @param target_resource_type [String] filter by target resource type @param monitor_condition [MonitorCondition] filter by monitor condition which is the state of the alert at monitor service. Possible values include: 'Fired', 'Resolved' @param severity [Severity] filter by severity. Possible values include: 'Sev0', 'Sev1', 'Sev2', 'Sev3', 'Sev4' @param alert_state [AlertState] filter by state. Possible values include: 'New', 'Acknowledged', 'Closed' @param smart_group_id [String] filter by smart Group Id @param include_payload [Boolean] include payload field content, default value is 'false'. @param page_count [Integer] number of items per page, default value is '25'. @param sort_by [AlertsSortByFields] sort the query results by input field, default value is 'lastModifiedDateTime'. Possible values include: 'name', 'severity', 'alertState', 'monitorCondition', 'targetResource', 'targetResourceName', 'targetResourceGroup', 'targetResourceType', 'startDateTime', 'lastModifiedDateTime' @param sort_order [Enum] sort the query results order in either ascending or descending, default value is 'desc' for time fields and 'asc' for others. Possible values include: 'asc', 'desc' @param time_range [TimeRange] filter by time range, default value is 1 day. Possible values include: '1h', '1d', '7d', '30d' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 97 def get_all_with_http_info(target_resource:nil, target_resource_group:nil, target_resource_type:nil, monitor_condition:nil, severity:nil, alert_state:nil, smart_group_id:nil, include_payload:nil, page_count:nil, sort_by:nil, sort_order:nil, time_range:nil, custom_headers:nil) get_all_async(target_resource:target_resource, target_resource_group:target_resource_group, target_resource_type:target_resource_type, monitor_condition:monitor_condition, severity:severity, alert_state:alert_state, smart_group_id:smart_group_id, include_payload:include_payload, page_count:page_count, sort_by:sort_by, sort_order:sort_order, time_range:time_range, custom_headers:custom_headers).value! end
Get a specific alert.
Get information related to a specific alert
@param alert_id [String] Unique ID of an alert object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Alert] operation results.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 199 def get_by_id(alert_id, custom_headers:nil) response = get_by_id_async(alert_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get a specific alert.
Get information related to a specific alert
@param alert_id [String] Unique ID of an alert object. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 230 def get_by_id_async(alert_id, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'alert_id is nil' if alert_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'alertId' => alert_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::Alert.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get a specific alert.
Get information related to a specific alert
@param alert_id [String] Unique ID of an alert object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 215 def get_by_id_with_http_info(alert_id, custom_headers:nil) get_by_id_async(alert_id, custom_headers:custom_headers).value! end
Get the history of the changes of an alert.
@param alert_id [String] Unique ID of an alert object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [AlertModification] operation results.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 390 def get_history(alert_id, custom_headers:nil) response = get_history_async(alert_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Get the history of the changes of an alert.
@param alert_id [String] Unique ID of an alert object. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 417 def get_history_async(alert_id, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, 'alert_id is nil' if alert_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alerts/{alertId}/history' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id,'alertId' => alert_id}, query_params: {'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertModification.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Get the history of the changes of an alert.
@param alert_id [String] Unique ID of an alert object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 404 def get_history_with_http_info(alert_id, custom_headers:nil) get_history_async(alert_id, custom_headers:custom_headers).value! end
Summary of alerts with the count each severity.
@param target_resource_group [String] filter by target resource group name @param time_range [TimeRange] filter by time range, default value is 1 day. Possible values include: '1h', '1d', '7d', '30d' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [AlertsSummary] operation results.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 482 def get_summary(target_resource_group:nil, time_range:nil, custom_headers:nil) response = get_summary_async(target_resource_group:target_resource_group, time_range:time_range, custom_headers:custom_headers).value! response.body unless response.nil? end
Summary of alerts with the count each severity.
@param target_resource_group [String] filter by target resource group name @param time_range [TimeRange] filter by time range, default value is 1 day. Possible values include: '1h', '1d', '7d', '30d' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 513 def get_summary_async(target_resource_group:nil, time_range:nil, custom_headers:nil) fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil? fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.AlertsManagement/alertsSummary' request_url = @base_url || @client.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'subscriptionId' => @client.subscription_id}, query_params: {'targetResourceGroup' => target_resource_group,'timeRange' => time_range,'api-version' => @client.api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::AlertsManagement::Mgmt::V2018_05_05_preview::Models::AlertsSummary.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Summary of alerts with the count each severity.
@param target_resource_group [String] filter by target resource group name @param time_range [TimeRange] filter by time range, default value is 1 day. Possible values include: '1h', '1d', '7d', '30d' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/2018-05-05-preview/generated/azure_mgmt_alerts_management/alerts.rb, line 498 def get_summary_with_http_info(target_resource_group:nil, time_range:nil, custom_headers:nil) get_summary_async(target_resource_group:target_resource_group, time_range:time_range, custom_headers:custom_headers).value! end