Add Cmdlets to Show / Remove SelfService Api Key

Fixes #35
This commit is contained in:
Christian Stein 2019-12-12 16:00:39 +01:00
parent b978ee6574
commit 4b87a68b58
2 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,14 @@
function Remove-IcingaDirectorSelfServiceKey()
{
$Path = 'IcingaDirector.SelfService.ApiKey';
$Value = Get-IcingaPowerShellConfig $Path;
if ($null -ne $Value) {
Remove-IcingaPowerShellConfig 'IcingaDirector.SelfService.ApiKey';
$Value = Get-IcingaPowerShellConfig $Path;
if ($null -eq $Value) {
Write-Host 'Icinga Director Self-Service Api key was successfully removed. Please dont forget to drop it within the Icinga Director as well';
}
} else {
Write-Host 'There is no Self-Service Api key configured on this system';
}
}

View file

@ -0,0 +1,11 @@
function Show-IcingaDirecorSelfServiceKey()
{
$Path = 'IcingaDirector.SelfService.ApiKey';
$Value = Get-IcingaPowerShellConfig $Path;
if ($null -ne $Value) {
Write-Host ([string]::Format('Self-Service Key: "{0}"', $Value));
} else {
Write-Host 'There is no Self-Service Api key configured on this system';
}
}