Skip to content

Commit

Permalink
Add Cmdlets to Show / Remove SelfService Api Key
Browse files Browse the repository at this point in the history
Fixes #35
  • Loading branch information
LordHepipud committed Dec 12, 2019
1 parent b978ee6 commit 4b87a68
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/core/tools/Remove-IcingaDirectorSelfServiceKey.psm1
Original file line number Diff line number Diff line change
@@ -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';
}
}
11 changes: 11 additions & 0 deletions lib/core/tools/Show-IcingaDirectorSelfServiceKey.psm1
Original file line number Diff line number Diff line change
@@ -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';
}
}

0 comments on commit 4b87a68

Please sign in to comment.