pub fn add_rule(
config_json: &str,
id: i64,
rule_config: &Value,
) -> Result<(String, i64)>Expand description
Add a new rule to the configuration
§Arguments
config_json- Configuration JSON stringrule_config- JSON configuration for the rule (must include ERRULE_CODE)
§Returns
Returns (modified_config, new_rule_id) tuple on success
§Example
use sz_configtool_lib::rules;
use serde_json::json;
let config = r#"{"G2_CONFIG": {"CFG_ERRULE": []}}"#;
let rule_config = json!({
"ERRULE_CODE": "CUSTOM_RULE",
"RESOLVE": "Yes",
"RELATE": "No",
"RTYPE_ID": 1
});
// ID parameter is required (0 for auto-assign, >0 for specific ID)
let (_modified, _rule_id) = rules::add_rule(config, 0, &rule_config).unwrap();