Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
334 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
docs/collections/_abouttopics/about_tsssecretdependency.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
category: secrets,dependencies | ||
title: "TssSecretDependency" | ||
last_modified_at: 2021-05-05T00:00:00-00:00 | ||
--- | ||
|
||
# TOPIC | ||
This help topic describes the TssSecretDependency class in the Thycotic.SecretServer module | ||
|
||
# CLASS | ||
TssSecretDependency | ||
|
||
# INHERITANCE | ||
None | ||
|
||
# DESCRIPTION | ||
The TssSecretDependency class represents the SecretDependencyModel object returned by Secret Server endpoint GET /secret-dependencies/{id} | ||
|
||
# CONSTRUCTORS | ||
new() | ||
|
||
# PROPERTIES | ||
Active: boolean | ||
Whether or not the Secret Dependency is active. | ||
|
||
ChildDependencyStatus: boolean | ||
The last run status of the child Secret Dependency. | ||
|
||
ConditionDependencyId: integer (int32) | ||
The Id of the dependency that will be looked at when Condition Mode is set to 'DEPENDENCYPASS', 'DEPENDENCYFAIL'. The Dependency must have a SortOrder lower than the current one. | ||
|
||
ConditionMode: string | ||
Condition Mode governs if this dependency's run relies on the result of other dependencies above it. The Default is ALWAYSRUN. Other values maybe 'All Pass', 'Any Fail', 'DEPENDENCYPASS', 'DEPENDENCYFAIL'. | ||
|
||
DependencyTemplate: SecretDependencyTemplate | ||
The DependencyTemplate properties that are populated if the Dependency is based on a Dependency template. | ||
|
||
Description: string | ||
A description for the Secret Dependency. | ||
|
||
GroupId: integer (int32) | ||
The Id of the Dependency Group that contains the Secret Dependency. | ||
|
||
Id: integer (int32) | ||
The Id of the Secret Dependency. | ||
|
||
LogMessage: string | ||
The last Log message for the Secret Dependency. | ||
|
||
PrivilegedAccountSecretId: integer (int32) | ||
The Id of the Privileged Secret that the Secret Dependency will use to run. | ||
|
||
RunScript: SecretDependencyRunScript | ||
The RunScript properties that are populated if the Dependency is directly running a script. | ||
|
||
SecretDependencyStatus: boolean | ||
The last run status of the Secret Dependency. | ||
|
||
SecretId: integer (int32) | ||
The Id of the Secret that the Secret Dependency is assigned to. | ||
|
||
SecretName: string | ||
The Name of the Secret that the Secret Dependency is assigned to. | ||
|
||
Settings: object[] | ||
The Settings used by the Secret Dependency. (Ex: WaitBeforeSeconds, Database, Port, SSHKeyDigest). If a setting exists with the same name (or intent in the case of Port and SqlPort) as a field on the Dependency template's DependencyScanItemFields collection, the value assigned to the setting takes precidence and will overwrite the corresponding DependencyScanItemField. | ||
|
||
SortOrder: integer (int32) | ||
The sort order of the Secret Dependency in the group. Determines the order of execution of the dependencies within a group. | ||
|
||
SshKeySecretId: integer (int32) | ||
The Id of the Secret containing the SSH key. (If dependency is tied to SSH key Secret | ||
|
||
SshKeySecretName: string | ||
The Name of the Secret containing the SSH key. (If dependency is tied to SSH key Secret | ||
|
||
TypeId: integer (int32) | ||
The Id of the type of Secret Dependency. | ||
|
||
TypeName: string | ||
The name of the type of Secret Dependency. | ||
|
||
# METHODS | ||
|
||
# RELATED LINKS: | ||
Get-TssSecretDependency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
class TssSecretDependency { | ||
[boolean] | ||
$Active | ||
|
||
[boolean] | ||
$ChildDependencyStatus | ||
|
||
[int] | ||
$ConditionDependencyId | ||
|
||
[string] | ||
$ConditionMode | ||
|
||
[pscustomobject] | ||
$DependencyTemplate | ||
|
||
[string] | ||
$Description | ||
|
||
[int] | ||
$GroupId | ||
|
||
[int] | ||
$Id | ||
|
||
[string] | ||
$LogMessage | ||
|
||
[int] | ||
$PrivilegedAccountSecretId | ||
|
||
[pscustomobject] | ||
$RunScript | ||
|
||
[boolean] | ||
$SecretDependencyStatus | ||
|
||
[int] | ||
$SecretId | ||
|
||
[string] | ||
$SecretName | ||
|
||
[pscustomobject[]] | ||
$Settings | ||
|
||
[int] | ||
$SortOrder | ||
|
||
[int] | ||
$SshKeySecretId | ||
|
||
[string] | ||
$SshKeySecretName | ||
|
||
[int] | ||
$TypeId | ||
|
||
[string] | ||
$TypeName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
TOPIC | ||
This help topic describes the TssSecretDependency class in the Thycotic.SecretServer module | ||
|
||
CLASS | ||
TssSecretDependency | ||
|
||
INHERITANCE | ||
None | ||
|
||
DESCRIPTION | ||
The TssSecretDependency class represents the SecretDependencyModel object returned by Secret Server endpoint GET /secret-dependencies/{id} | ||
|
||
CONSTRUCTORS | ||
new() | ||
|
||
PROPERTIES | ||
Active: boolean | ||
Whether or not the Secret Dependency is active. | ||
|
||
ChildDependencyStatus: boolean | ||
The last run status of the child Secret Dependency. | ||
|
||
ConditionDependencyId: integer (int32) | ||
The Id of the dependency that will be looked at when Condition Mode is set to 'DEPENDENCYPASS', 'DEPENDENCYFAIL'. The Dependency must have a SortOrder lower than the current one. | ||
|
||
ConditionMode: string | ||
Condition Mode governs if this dependency's run relies on the result of other dependencies above it. The Default is ALWAYSRUN. Other values maybe 'All Pass', 'Any Fail', 'DEPENDENCYPASS', 'DEPENDENCYFAIL'. | ||
|
||
DependencyTemplate: SecretDependencyTemplate | ||
The DependencyTemplate properties that are populated if the Dependency is based on a Dependency template. | ||
|
||
Description: string | ||
A description for the Secret Dependency. | ||
|
||
GroupId: integer (int32) | ||
The Id of the Dependency Group that contains the Secret Dependency. | ||
|
||
Id: integer (int32) | ||
The Id of the Secret Dependency. | ||
|
||
LogMessage: string | ||
The last Log message for the Secret Dependency. | ||
|
||
PrivilegedAccountSecretId: integer (int32) | ||
The Id of the Privileged Secret that the Secret Dependency will use to run. | ||
|
||
RunScript: SecretDependencyRunScript | ||
The RunScript properties that are populated if the Dependency is directly running a script. | ||
|
||
SecretDependencyStatus: boolean | ||
The last run status of the Secret Dependency. | ||
|
||
SecretId: integer (int32) | ||
The Id of the Secret that the Secret Dependency is assigned to. | ||
|
||
SecretName: string | ||
The Name of the Secret that the Secret Dependency is assigned to. | ||
|
||
Settings: object[] | ||
The Settings used by the Secret Dependency. (Ex: WaitBeforeSeconds, Database, Port, SSHKeyDigest). If a setting exists with the same name (or intent in the case of Port and SqlPort) as a field on the Dependency template's DependencyScanItemFields collection, the value assigned to the setting takes precidence and will overwrite the corresponding DependencyScanItemField. | ||
|
||
SortOrder: integer (int32) | ||
The sort order of the Secret Dependency in the group. Determines the order of execution of the dependencies within a group. | ||
|
||
SshKeySecretId: integer (int32) | ||
The Id of the Secret containing the SSH key. (If dependency is tied to SSH key Secret | ||
|
||
SshKeySecretName: string | ||
The Name of the Secret containing the SSH key. (If dependency is tied to SSH key Secret | ||
|
||
TypeId: integer (int32) | ||
The Id of the type of Secret Dependency. | ||
|
||
TypeName: string | ||
The name of the type of Secret Dependency. | ||
|
||
METHODS | ||
|
||
RELATED LINKS: | ||
Get-TssSecretDependency |
70 changes: 70 additions & 0 deletions
70
src/functions/secret-dependencies/Get-SecretDependency.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
function Get-SecretDependency { | ||
<# | ||
.SYNOPSIS | ||
Get a Secret Dependency | ||
.DESCRIPTION | ||
Get a Secret Dependency | ||
.EXAMPLE | ||
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred | ||
Get-TssSecretDependency -TssSession $session -Id 24 | ||
Return the Secret Dependency 24 | ||
.LINK | ||
https://thycotic-ps.github.io/thycotic.secretserver/commands/Get-TssSecretDependency | ||
.LINK | ||
https://github.com/thycotic-ps/thycotic.secretserver/blob/main/src/functions/<folder>/Get-SecretDependency.ps1 | ||
.NOTES | ||
Requires TssSession object returned by New-TssSession | ||
#> | ||
[CmdletBinding()] | ||
[OutputType('TssSecretDependency')] | ||
param ( | ||
# TssSession object created by New-TssSession for auth | ||
[Parameter(Mandatory,ValueFromPipeline,Position = 0)] | ||
[TssSession] | ||
$TssSession, | ||
|
||
# Short description for parameter | ||
[Parameter(Mandatory,ValueFromPipelineByPropertyName)] | ||
[Alias("SecretDependencyId")] | ||
[int[]] | ||
$Id | ||
) | ||
begin { | ||
$tssParams = $PSBoundParameters | ||
$invokeParams = . $GetInvokeTssParams $TssSession | ||
} | ||
|
||
process { | ||
Write-Verbose "Provided command parameters: $(. $GetInvocation $PSCmdlet.MyInvocation)" | ||
if ($tssParams.ContainsKey('TssSession') -and $TssSession.IsValidSession()) { | ||
. $CheckVersion $TssSession '10.9.000000' $PSCmdlet.MyInvocation | ||
foreach ($dependency in $Id) { | ||
$restResponse = $null | ||
$uri = $TssSession.ApiUrl, 'secret-dependencies', $dependency -join '/' | ||
$invokeParams.Uri = $uri | ||
$invokeParams.Method = 'GET' | ||
|
||
Write-Verbose "Performing the operation $($invokeParams.Method) $uri" | ||
try { | ||
$restResponse = . $InvokeApi @invokeParams | ||
} catch { | ||
Write-Warning "Issue getting Secret Dependency [$dependency]" | ||
$err = $_ | ||
. $ErrorHandling $err | ||
} | ||
|
||
if ($restResponse) { | ||
[TssSecretDependency]$restResponse | ||
} | ||
} | ||
} else { | ||
Write-Warning "No valid session found" | ||
} | ||
} | ||
} |
Oops, something went wrong.