Skip to content

Commit

Permalink
Seach-TssSecret - rename FieldText > SearchText add alias SecretName
Browse files Browse the repository at this point in the history
closes #102
  • Loading branch information
wsmelton committed Mar 2, 2021
1 parent 5868714 commit 5c1fc4b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
27 changes: 23 additions & 4 deletions src/functions/secrets/Search-Secret.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ function Search-Secret {
Return all secrets using Secret Template 6047 that are active **and** inactive.
.EXAMPLE
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
Search-TssSecret -TssSession $session -SecretName 'Azure'
Return all secrets that have Azure in the name of the Secret (wildcard search)
.EXAMPLE
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
Search-TssSecret -TssSession $session -SecretName 'Azure Test Account' -ExactMatch
Return all secret(s) that have the exact name "Azure Test Account"
.EXAMPLE
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
Search-TssSecret -TssSession $session -Field username -SearchText 'root'
Return all secret(s) that have the username "root"
.LINK
https://thycotic-ps.github.io/thycotic.secretserver/commands/Search-TssSecret
Expand Down Expand Up @@ -61,10 +79,11 @@ function Search-Secret {
# Text of the field to filter on
[Parameter(ParameterSetName = "filter")]
[Parameter(ParameterSetName = "field")]
[Alias('SecretName')]
[string]
$FieldText,
$SearchText,

# Match the exact text of the FieldText
# Match the exact text of the SearchText
[Parameter(ParameterSetName = "filter")]
[Parameter(ParameterSetName = "field")]
[switch]
Expand Down Expand Up @@ -190,8 +209,8 @@ function Search-Secret {
'FieldSlug' {
$filters += "filter.searchFieldSlug=$($tssParams['FieldSlug'])"
}
'FieldText' {
$filters += "filter.searchText=$($tssParams['FieldText'])"
'SearchText' {
$filters += "filter.searchText=$($tssParams['SearchText'])"
}
'ExactMatch' {
$filters += "filter.isExactmatch=$($tssParams['ExactMatch'])"
Expand Down
2 changes: 1 addition & 1 deletion tests/secrets/Search-TssSecret.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Describe "$commandName verify parameters" {
# Folder param set
'FolderId', 'IncludeSubFolders',
# field param set
'Field', 'FieldText', 'ExactMatch', 'FieldSlug', 'ExtendedField', 'ExtendedTypeId',
'Field', 'SearchText', 'ExactMatch', 'FieldSlug', 'ExtendedField', 'ExtendedTypeId',
# secret param set
'SecretTemplateId', 'SiteId', 'HeartbeatStatus', 'IncludeInactive', 'ExcludeActive', 'RpcEnabled', 'SharedWithMe', 'PasswordTypeIds', 'ExcludeDoubleLock', 'DoubleLockId'
[object[]]$currentParams = ([Management.Automation.CommandMetaData]$ExecutionContext.SessionState.InvokeCommand.GetCommand($commandName, 'Function')).Parameters.Keys
Expand Down

0 comments on commit 5c1fc4b

Please sign in to comment.