Name
sn_em_tbac.EvtMgmtTagBasedAlertClusteringAPIs
Description
APIs that are exposed to external scopes (global or other scoped apps).
Script
var EvtMgmtTagBasedAlertClusteringAPIs = Class.create();
EvtMgmtTagBasedAlertClusteringAPIs.prototype = {
initialize: function() {
this.tbacUtils = new EvtMgmtTagBasedAlertClusteringUtils();
},
/**
* Creates tag based alert clustering tag with the given parameters.
* @param source - REQUIRED - the source from which to choose the field to be matched (em_alert, cmdb_key_value, etc...).
* @param sourceField - REQUIRED - the field or key value to group on, in relation to the chosen source (e.g., 'selected_field' if source=em_alert).
* @param matchMethod - REQUIRED - the type of match required for the alerts to be included in a group (exact, fuzzy, etc...).
* @param matchMethodValue - CONDITIONALLY REQUIRED - Required only when matchMethod is different than "exact". The value for the given match method (e.g., the fuzzy_similarity value if matchMethod=fuzzy).
* @param description - OPTIONAL - description for the TBAC tag record.
* @param name - OPTIONAL - name for the TBAC tag record.
* @param domainId - OPTIONAL - the domain ID for the TBAC tag record. Defaults to the current user domain ID.
* @returns {string} - the sys_id of the inserted record, if inserted successfully, or undefined/false otherwise.
*/
createTag: function(source, sourceField, matchMethod, matchMethodValue, description, name, domainId) {
this.tbacUtils.createTag(source, sourceField, matchMethod, matchMethodValue, description, name, domainId);
},
/**
* Exposes an API to create a tag based alert clustering tag specifically for Alert Tags (em_alert_tags).
*/
createTagForAlertTags: function(sourceField) {
var SOURCE = 'alert_tags';
var tagsPrefix = gs.getProperty('evt_mgmt.alert_tags_prefix', 't_');
if (!sourceField || (typeof sourceField != 'string') || !sourceField.startsWith(tagsPrefix))
return;
var matchMethod = 'exact';
var matchMethodValue = '';
var description = 'Automatically generated from alert tags';
this.createTag(SOURCE, sourceField, matchMethod, matchMethodValue, description);
},
type: 'EvtMgmtTagBasedAlertClusteringAPIs'
};
Sys ID
767425390b711110116c898d5777b27b