icinga-powershell-framework/lib/daemons/RestAPI/client/Test-IcingaRESTClientConnection.psm1
Lord Hepipud 4ef55bddb4 Fixes lots of code styling, spelling and script analyzer
Disabling UseConsistentIndentation because it is not
properly working for multi-line commands with arguments
and array/hashtable objects
2022-01-14 22:26:53 +01:00

22 lines
776 B
PowerShell

function Test-IcingaRESTClientConnection()
{
param(
[Hashtable]$Connection = @{ }
);
# If we couldn't establish a proper SSL stream, close the connection
# immediately without opening a client connection thread
if ($null -eq $Connection.Stream) {
Add-IcingaRESTClientBlacklistCount `
-Client $Connection.Client `
-ClientList $IcingaDaemonData.BackgroundDaemon.IcingaPowerShellRestApi.ClientBlacklist;
Write-IcingaEventMessage -EventId 1501 -Namespace 'Framework' -Objects $Connection.Client.Client;
Close-IcingaTCPConnection -Client $Connection.Client;
$Connection = $null;
return $FALSE;
}
Write-IcingaDebugMessage 'Client connection has passed Test';
return $TRUE;
}