Adds function for simple navigation through REST-Api calls

This commit is contained in:
Christian Stein 2020-03-25 17:50:02 +01:00
parent e56861d858
commit abb2ab1e35

View 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];
}