protected override void ProcessRecord() { if (isInitialized()) { try { iControl.LocalLBRuleRuleDefinition[] rule_defs = GetiControl().LocalLBRule.query_all_rules(); foreach (iControl.LocalLBRuleRuleDefinition rule_def in rule_defs) { bool bMatch = true; if (null != _name) { bMatch = (true == matchString(rule_def.rule_name, _name)); } if (bMatch) { LTMRuleDefinitionItem item = new LTMRuleDefinitionItem(); item.Name = rule_def.rule_name; item.Definition = rule_def.rule_definition; WriteObject(item); } } } catch (Exception ex) { ErrorRecord er = new ErrorRecord(ex, "2", ErrorCategory.OpenError, "error"); WriteError(er); } } else { handleNotInitialized(); } }
protected override void ProcessRecord() { if (ValidateInput()) { if (isInitialized()) { try { String[] vs_list = GetiControl().LocalLBVirtualServer.get_list(); iControl.CommonEnabledState[] enabled_states = GetiControl().LocalLBVirtualServer.get_enabled_state(vs_list); // Build a list of indexes ArrayList index_list = new ArrayList(); for (int i = 0; i < vs_list.Length; i++) { if (true == matchString(vs_list[i], _name)) { index_list.Add(i); } } if (index_list.Count > 0) { String[] target_vs_list = new String[index_list.Count]; for (int j = 0; j < index_list.Count; j++) { int index = Convert.ToInt32(index_list[j]); target_vs_list[j] = vs_list[index]; } iControl.LocalLBVirtualServerVirtualServerRule[][] rule_lists = GetiControl().LocalLBVirtualServer.get_rule(target_vs_list); String [] target_rules; for (int i = 0; i < rule_lists.Length; i++) { target_rules = new String[rule_lists[i].Length]; for (int j = 0; j < rule_lists[i].Length; j++) { target_rules[j] = rule_lists[i][j].rule_name; } iControl.LocalLBRuleRuleDefinition [] rule_defs = GetiControl().LocalLBRule.query_rule(target_rules); for (int j = 0; j < rule_defs.Length; j++) { bool bFoundMatch = true; if (null != Rule) { bFoundMatch = false; if (true == matchString(rule_defs[j].rule_name, Rule)) { bFoundMatch = true; } } if (bFoundMatch) { LTMRuleDefinitionItem item = new LTMRuleDefinitionItem(); item.Name = rule_defs[j].rule_name; item.Definition = rule_defs[j].rule_definition; WriteObject(item); } } } } } catch (Exception ex) { handleException(ex); } } else { handleNotInitialized(); } } }