Skip to main content

clone_generic_plan

Function clone_generic_plan 

Source
pub fn clone_generic_plan(
    config_json: &str,
    source_gplan_code: &str,
    new_gplan_code: &str,
    new_gplan_desc: Option<&str>,
) -> Result<(String, i64)>
Expand description

Clone a generic plan with all its thresholds

§Arguments

  • config_json - Configuration JSON string
  • source_gplan_code - Source plan code to clone from
  • new_gplan_code - New plan code to create
  • new_gplan_desc - Optional description for new plan (uses code if None)

§Returns

Returns (modified_config, new_plan_id) tuple on success

§Example

use sz_configtool_lib::generic_plans;

let config = r#"{"G2_CONFIG": {"CFG_GPLAN": [{"GPLAN_ID": 1, "GPLAN_CODE": "INGEST"}], "CFG_GENERIC_THRESHOLD": [{"GPLAN_ID": 1, "BEHAVIOR": "NAME"}]}}"#;
let (modified, plan_id) = generic_plans::clone_generic_plan(config, "INGEST", "CUSTOM", None).unwrap();