functions/character-sets/Get-TssCharacterSetAudit.ps1
|
function Get-TssCharacterSetAudit { <# .SYNOPSIS Get audit entries for a character set .DESCRIPTION Returns the audit records for the given character set. Creating a character set records a Create entry; the built-in character sets have no records until they are changed. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Character set ID .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssCharacterSetAudit -TssSession $session -Id 9 Returns the audit records for character set ID 9 .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/character-sets/Get-TssCharacterSetAudit .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/character-sets/Get-TssCharacterSetAudit.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.CharacterSets.Audit[]')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('CharacterSetId')] [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, 'character-sets', $currentId, 'audit' -join '/' $queryParams = @() $queryParams += "take=$($TssSession.Take)" if ($queryParams) { $uri = $uri, ($queryParams -join '&') -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-TssCharacterSetAudit request' $err = $_ . $ErrorHandling $err } if ($restResponse.records) { [Thycotic.PowerShell.CharacterSets.Audit[]](. $FilterTssResponse $restResponse.records ([Thycotic.PowerShell.CharacterSets.Audit])) } } } else { Write-Warning 'No valid session found' } } } |