Skip to content

Commit 69b6d13

Browse files
committed
added formating for ssloptions and predefined policy
1 parent 81f1344 commit 69b6d13

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

src/ResourceManager/Network/Commands.Network/ApplicationGateway/ApplicationGatewayPowerShellFormatting.cs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,71 @@ private static string NormalizeStringLength(string str, int targetLength, char f
129129
return str;
130130
}
131131
}
132+
133+
public static string Format(PSApplicationGatewaySslPredefinedPolicy policy, int depth = 0)
134+
{
135+
string prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
136+
StringBuilder output = new StringBuilder();
137+
138+
output.AppendFormat("{0}{1}: {2}", prefix, "Name" , policy.Name);
139+
output.AppendLine();
140+
141+
output.AppendFormat("{0}{1}: {2}", prefix, "MinProtocolVersion", policy.MinProtocolVersion);
142+
output.AppendLine();
143+
144+
output.AppendFormat("{0}{1}:", prefix, "CipherSuites");
145+
output.AppendLine();
146+
depth++;
147+
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
148+
foreach (var cipher in policy.CipherSuites)
149+
{
150+
output.AppendFormat("{0}{1}", prefix, cipher);
151+
}
152+
153+
return output.ToString();
154+
}
155+
156+
public static string Format(PSApplicationGatewayAvailableSslOptions availableSslOptions, int depth = 0)
157+
{
158+
string prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
159+
StringBuilder output = new StringBuilder();
160+
161+
output.AppendFormat("{0}{1}: {2}", prefix, "DefaultPolicy", availableSslOptions.DefaultPolicy);
162+
output.AppendLine();
163+
164+
output.AppendFormat("{0}{1}:", prefix, "PredefinedPolicies");
165+
output.AppendLine();
166+
depth++;
167+
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
168+
foreach (var policy in availableSslOptions.PredefinedPolicies)
169+
{
170+
output.AppendFormat("{0}{1}", prefix, policy);
171+
}
172+
depth--;
173+
output.AppendLine();
174+
175+
output.AppendFormat("{0}{1}:", prefix, "AvailableCipherSuites");
176+
output.AppendLine();
177+
depth++;
178+
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
179+
foreach (var cipher in availableSslOptions.AvailableCipherSuites)
180+
{
181+
output.AppendFormat("{0}{1}", prefix, cipher);
182+
}
183+
depth--;
184+
output.AppendLine();
185+
186+
output.AppendFormat("{0}{1}:", prefix, "AvailableProtocols");
187+
output.AppendLine();
188+
depth++;
189+
prefix = new string(' ', depth * ApplicationGatewayPowerShellFormatting.TabSize);
190+
foreach (var protocol in availableSslOptions.AvailableProtocols)
191+
{
192+
output.AppendFormat("{0}{1}", prefix, protocol);
193+
}
194+
depth--;
195+
196+
return output.ToString();
197+
}
132198
}
133199
}

0 commit comments

Comments
 (0)