Skip to main content

delete_generic_plan

Function delete_generic_plan 

Source
pub fn delete_generic_plan(
    config_json: &str,
    gplan_code: &str,
) -> Result<String>
Expand description

Delete a generic plan and all its thresholds

§Arguments

  • config_json - Configuration JSON string
  • gplan_code - Plan code to delete

§Returns

Returns modified configuration JSON on success

§Example

use sz_configtool_lib::generic_plans;

// System plans (ID ≤ 2) cannot be deleted, use ID > 2 for user plans
let config = r#"{"G2_CONFIG": {"CFG_GPLAN": [{"GPLAN_ID": 3, "GPLAN_CODE": "CUSTOM_PLAN"}], "CFG_GENERIC_THRESHOLD": []}}"#;
let modified = generic_plans::delete_generic_plan(config, "CUSTOM_PLAN").unwrap();