diff --git a/lib/web/Get-IcingaRESTPathElement.psm1 b/lib/web/Get-IcingaRESTPathElement.psm1 new file mode 100644 index 0000000..549d3fe --- /dev/null +++ b/lib/web/Get-IcingaRESTPathElement.psm1 @@ -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]; +}