public static string Format(PSApplicationGatewayAvailableWafRuleSetsResult availableWafRuleSets, int depth = 0) { string prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); StringBuilder output = new StringBuilder(); foreach (var ruleSet in availableWafRuleSets.Value) { output.Append(ApplicationGatewayPowerShellFormatting.Format(ruleSet, depth)); output.AppendLine(); } return(output.ToString()); }
public static string Format(PSApplicationGatewayFirewallRuleSet ruleSet, int depth = 0) { string prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); StringBuilder output = new StringBuilder(); output.AppendFormat("{0}{1} (Ver. {2}):\n", prefix, ruleSet.RuleSetType, ruleSet.RuleSetVersion); foreach (var ruleGroup in ruleSet.RuleGroups) { output.AppendLine(); output.Append(ApplicationGatewayPowerShellFormatting.Format(ruleGroup, depth + 1)); } return(output.ToString()); }
public static string Format(PSApplicationGatewayFirewallRuleGroup ruleGroup, int depth = 0) { string prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); StringBuilder output = new StringBuilder(); output.AppendFormat("{0}{1}:\n", prefix, ruleGroup.RuleGroupName); depth++; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat("{0}{1}\n", prefix, "Description:"); depth++; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat("{0}{1}\n", prefix, ruleGroup.Description); depth--; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat("{0}{1}\n", prefix, "Rules:"); depth++; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat( ApplicationGatewayPowerShellFormatting.RuleFormat, prefix, ApplicationGatewayPowerShellFormatting.NormalizeStringLength("RuleId", ApplicationGatewayPowerShellFormatting.MaxRuleIdLength), "Description"); output.AppendFormat( ApplicationGatewayPowerShellFormatting.RuleFormat, prefix, ApplicationGatewayPowerShellFormatting.NormalizeStringLength("------", ApplicationGatewayPowerShellFormatting.MaxRuleIdLength), "-----------"); foreach (var rule in ruleGroup.Rules) { output.Append(ApplicationGatewayPowerShellFormatting.Format(rule, depth)); } return(output.ToString()); }