From 05673439a8cdfcfd68fa6067c48572b0f5777d82 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Thu, 10 Nov 2022 21:45:29 +0000 Subject: [PATCH] Adding Get-LaMetricTime -Package (Fixes #72) --- Functions/LaMetric/Get-LaMetricTime.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Functions/LaMetric/Get-LaMetricTime.ps1 b/Functions/LaMetric/Get-LaMetricTime.ps1 index ce2d624..e266c6a 100644 --- a/Functions/LaMetric/Get-LaMetricTime.ps1 +++ b/Functions/LaMetric/Get-LaMetricTime.ps1 @@ -22,7 +22,10 @@ function Get-LaMetricTime { [Parameter(Mandatory,ParameterSetName='api/v2/device/apps')] [Alias('App','Apps','Applications')] [switch] - $Application + $Application, + [Parameter(Mandatory,ParameterSetName='api/v2/device/apps/$Package',ValueFromPipelineByPropertyName)] + [string] + $Package ) begin { if (-not $script:LaMetricTimeCache) { @@ -33,6 +36,7 @@ function Get-LaMetricTime { } $friendlyParameterSetNames = @{ "api/v2/device/apps" = "Application" + 'api/v2/device/apps/$packages' = "Application.Details" } $expandPropertiesIn = @("api/v2/device/apps") } @@ -60,7 +64,8 @@ function Get-LaMetricTime { if ($PSCmdlet.ParameterSetName -like 'api*') { foreach ($ip in $IPAddress) { $ipAndPort = "${ipAddress}:8080" - $endpoint = $PSCmdlet.ParameterSetName -replace '^api' + $endpoint = + $ExecutionContext.SessionState.InvokeCommand.ExpandString($PSCmdlet.ParameterSetName) -replace '^api' $typename = if ($friendlyParameterSetNames[$PSCmdlet.ParameterSetName]) { $friendlyParameterSetNames[$PSCmdlet.ParameterSetName]