mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Adds function for simple navigation through REST-Api calls
This commit is contained in:
parent
e56861d858
commit
abb2ab1e35
1 changed files with 21 additions and 0 deletions
21
lib/web/Get-IcingaRESTPathElement.psm1
Normal file
21
lib/web/Get-IcingaRESTPathElement.psm1
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
function Get-IcingaRESTPathElement()
|
||||
{
|
||||
param(
|
||||
[Hashtable]$Request = @{},
|
||||
[int]$Index = 0
|
||||
);
|
||||
|
||||
if ($null -eq $Request -Or $Request.Count -eq 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($Request.ContainsKey('RequestPath') -eq $FALSE) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (($Index + 1) -gt $Request.RequestPath.PathArray.Count) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $Request.RequestPath.PathArray[$Index];
|
||||
}
|
||||
Loading…
Reference in a new issue