Skip to main content

get_rule

Function get_rule 

Source
pub fn get_rule(config_json: &str, code_or_id: &str) -> Result<Value>
Expand description

Get a rule by code or ID

§Arguments

  • config_json - Configuration JSON string
  • code_or_id - Rule code or ID to search for

§Returns

Returns the rule JSON object on success

§Example

use sz_configtool_lib::rules;

let config = r#"{"G2_CONFIG": {"CFG_ERRULE": [{"ERRULE_ID": 1, "ERRULE_CODE": "TEST"}]}}"#;
let rule = rules::get_rule(config, "TEST").unwrap();