mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
37 lines
811 B
PowerShell
37 lines
811 B
PowerShell
function ConvertFrom-IcingaArrayToString()
|
|
{
|
|
param (
|
|
[array]$Array = @(),
|
|
[switch]$AddQuotes = $FALSE,
|
|
[switch]$SecureContent = $FALSE
|
|
);
|
|
|
|
if ($null -eq $Array -Or $Array.Count -eq 0) {
|
|
if ($AddQuotes) {
|
|
return '""';
|
|
}
|
|
|
|
return '';
|
|
}
|
|
|
|
[array]$NewArray = @();
|
|
|
|
if ($AddQuotes) {
|
|
foreach ($entry in $Array) {
|
|
if ($SecureContent) {
|
|
$entry = '***';
|
|
}
|
|
$NewArray += ([string]::Format('"{0}"', $entry));
|
|
}
|
|
} else {
|
|
if ($SecureContent) {
|
|
foreach ($entry in $Array) {
|
|
$NewArray += '***';
|
|
}
|
|
} else {
|
|
$NewArray = $Array;
|
|
}
|
|
}
|
|
|
|
return ([string]::Join(', ', $NewArray));
|
|
}
|