functions/event-pipeline-policy/Search-TssEventPipelinePolicyGroup.ps1
|
function Search-TssEventPipelinePolicyGroup { <# .SYNOPSIS Get the groups an event pipeline policy is assigned to .DESCRIPTION Returns the groups an event pipeline policy is assigned to (user and group policies). .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Event pipeline policy ID .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Search-TssEventPipelinePolicyGroup -TssSession $session -Id 4 Returns the groups event pipeline policy 4 is assigned to .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/event-pipeline-policies/Search-TssEventPipelinePolicyGroup .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/event-pipeline-policy/Search-TssEventPipelinePolicyGroup.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.EventPipelinePolicy.Group[]')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('EventPipelinePolicyId')] [int[]] $Id ) begin { $tssParams = $PSBoundParameters $invokeParams = . $GetInvokeApiParams $TssSession } process { Get-TssInvocation $PSCmdlet.MyInvocation if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { Compare-TssVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation foreach ($currentId in $Id) { $restResponse = $null $uri = $TssSession.ApiUrl, 'event-pipeline-policy', $currentId, 'groups' -join '/' $invokeParams.Uri = $uri $invokeParams.Method = 'GET' Write-Verbose "Performing the operation $($invokeParams.Method) $uri" try { $apiResponse = Invoke-TssApi @invokeParams $restResponse = . $ProcessResponse $apiResponse } catch { Write-Warning 'Issue with Search-TssEventPipelinePolicyGroup request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.EventPipelinePolicy.Group[]](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.EventPipelinePolicy.Group])) } } } else { Write-Warning 'No valid session found' } } } |