functions/discovery/Get-TssDiscoveryDependencyRule.ps1
|
function Get-TssDiscoveryDependencyRule { <# .SYNOPSIS Get a Discovery dependency rule .DESCRIPTION Returns the detail of one or more Discovery dependency rules by id: scan template, dependency template, privileged account and restart setting. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Discovery dependency rule id .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssDiscoveryDependencyRule -TssSession $session -Id 2 Get Discovery dependency rule 2 .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/discovery/Get-TssDiscoveryDependencyRule .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/discovery/Get-TssDiscoveryDependencyRule.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Discovery.DependencyRule')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('RuleId')] [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, 'discovery', 'rules', 'dependencies', $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-TssDiscoveryDependencyRule request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.Discovery.DependencyRule](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.Discovery.DependencyRule])) } } } else { Write-Warning 'No valid session found' } } } |