functions/discovery/Get-TssDiscoveryDependencyRuleInfo.ps1
|
function Get-TssDiscoveryDependencyRuleInfo { <# .SYNOPSIS Get the options for a Discovery dependency rule .DESCRIPTION Returns the dependency templates, secret templates and password types that a Discovery dependency rule can use for the given scan template, and whether a privileged account secret is required. .PARAMETER TssSession TssSession object created by New-TssSession for authentication .PARAMETER Id Discovery scan template id .EXAMPLE $session = New-TssSession -SecretServer https://alpha -Credential $ssCred Get-TssDiscoveryDependencyRuleInfo -TssSession $session -Id 6 Get the dependency rule options for scan template 6 .LINK https://thycotic-ps.github.io/thycotic.secretserver/commands/discovery/Get-TssDiscoveryDependencyRuleInfo .LINK https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/discovery/Get-TssDiscoveryDependencyRuleInfo.ps1 .NOTES Requires TssSession object returned by New-TssSession #> [CmdletBinding()] [OutputType('Thycotic.PowerShell.Discovery.DependencyRuleInfo')] param ( [Parameter(Mandatory, ValueFromPipeline, Position = 0)] [Thycotic.PowerShell.Authentication.Session] $TssSession, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [Alias('ScanTemplateId')] [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', 'info', $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-TssDiscoveryDependencyRuleInfo request' $err = $_ . $ErrorHandling $err } if ($restResponse) { [Thycotic.PowerShell.Discovery.DependencyRuleInfo](. $FilterTssResponse $restResponse ([Thycotic.PowerShell.Discovery.DependencyRuleInfo])) } } } else { Write-Warning 'No valid session found' } } } |