functions/inbox-rules/Get-TssInboxRule.ps1
|
function Get-TssInboxRule { <# .SYNOPSIS Get an inbox rule .DESCRIPTION Get an inbox (notification) rule by ID, with its message types, conditions and email and Slack actions. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Inbox rule ID .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssInboxRule -TssSession $session -Id 1 Return inbox rule 1 (Password Reset on a new install) .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Search-TssInboxRule -TssSession $session | Get-TssInboxRule -TssSession $session Return the full details of every active inbox rule .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/inbox-rules/Get-TssInboxRule .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/inbox-rules/Get-TssInboxRule.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.InboxRules.InboxRule')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('InboxRuleId')] [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, 'inbox-rules', $currentId -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 Get-TssInboxRule request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.InboxRules.InboxRule](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.InboxRules.InboxRule])) } } } else { Write-Warning 'No valid session found' } } } |