Skip to content

Added formating for ssloptions and predefined policy #4285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,77 @@ private static string NormalizeStringLength(string str, int targetLength, char f
return str;
}
}

public static string Format(PSApplicationGatewaySslPredefinedPolicy policy, int depth = 0)
{
string prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
StringBuilder output = new StringBuilder();

output.AppendFormat("{0}{1}: {2}", prefix, "Name" , policy.Name);
output.AppendLine();

output.AppendFormat("{0}{1}: {2}", prefix, "MinProtocolVersion", policy.MinProtocolVersion);
output.AppendLine();

output.AppendFormat("{0}{1}:", prefix, "CipherSuites");
output.AppendLine();
depth++;
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
foreach (var cipher in policy.CipherSuites)
{
output.AppendFormat("{0}{1}", prefix, cipher);
output.AppendLine();
}
output.AppendLine();

return output.ToString();
}

public static string Format(PSApplicationGatewayAvailableSslOptions availableSslOptions, int depth = 0)
{
string prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
StringBuilder output = new StringBuilder();

output.AppendFormat("{0}{1}: {2}", prefix, "DefaultPolicy", availableSslOptions.DefaultPolicy);
output.AppendLine();

output.AppendFormat("{0}{1}:", prefix, "PredefinedPolicies");
output.AppendLine();
depth++;
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
foreach (var policy in availableSslOptions.PredefinedPolicies)
{
output.AppendFormat("{0}{1}", prefix, policy.Id);
output.AppendLine();
}
output.AppendLine();

depth--;
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
output.AppendFormat("{0}{1}:", prefix, "AvailableCipherSuites");
output.AppendLine();
depth++;
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
foreach (var cipher in availableSslOptions.AvailableCipherSuites)
{
output.AppendFormat("{0}{1}", prefix, cipher);
output.AppendLine();
}
output.AppendLine();

depth--;
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
output.AppendFormat("{0}{1}:", prefix, "AvailableProtocols");
output.AppendLine();
depth++;
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
foreach (var protocol in availableSslOptions.AvailableProtocols)
{
output.AppendFormat("{0}{1}", prefix, protocol);
output.AppendLine();
}

return output.ToString();
}
}
}