Skip to content

Commit

Permalink
TssSecretLookup - migrate and update --> Thycotic.PowerShell.Secrets.…
Browse files Browse the repository at this point in the history
…Lookup
  • Loading branch information
wsmelton committed Jul 20, 2021
1 parent 49ad378 commit b954371
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 25 deletions.
10 changes: 5 additions & 5 deletions docs/about_topics/secrets/about_tsssecretlookup.md
@@ -1,21 +1,21 @@
---
title: "TssSecretLookup"
title: "Thycotic.PowerShell.Secrets.Lookup"
---

# TOPIC
This help topic describes the TssSecretLookup class in the Thycotic.SecretServer module.
This help topic describes the Thycotic.PowerShell.Secrets.Lookup class in the Thycotic.SecretServer module.

# CLASS
TssSecretLookup
Thycotic.PowerShell.Secrets.Lookup

# INHERITANCE
None

# DESCRIPTION
The TssSecretLookup class represents a revised version of the SecretLookup object returned by Secret Server endpoint /secrets/lookup.
The Thycotic.PowerShell.Secrets.Lookup class represents a revised version of the SecretLookup object returned by Secret Server endpoint /secrets/lookup.
This endpoint returns records as ID and Value:
"id": <secret id>
"value: "<Folder ID> - <Secret Tempalte ID> - <Secret Name>
"value: "<Folder ID> - <Secret Template ID> - <Secret Name>
This class is revising this to output the items in the value as proper properties (handled by the calling function).

# CONSTRUCTORS
Expand Down
2 changes: 1 addition & 1 deletion docs/commands/secrets/Find-TssSecret.md
Expand Up @@ -386,7 +386,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## OUTPUTS

### TssSecretLookup
### Thycotic.PowerShell.Secrets.Lookup
## NOTES
Requires TssSession object returned by New-TssSession

Expand Down
2 changes: 1 addition & 1 deletion src/Thycotic.SecretServer.Types.ps1xml
Expand Up @@ -129,7 +129,7 @@
</Members>
</Type>
<Type>
<Name>TssSecretLookup</Name>
<Name>Thycotic.PowerShell.Secrets.Lookup</Name>
<Members>
<AliasProperty>
<Name>SecretId</Name>
Expand Down
15 changes: 15 additions & 0 deletions src/Thycotic.SecretServer/classes/secrets/Lookup.cs
@@ -0,0 +1,15 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;

namespace Thycotic.PowerShell.Secrets
{
public class Lookup
{
public int Id { get; set; }
public int FolderId { get; set; }
public int SecretTemplateId { get; set; }
public string SecretName { get; set; }
}
}
13 changes: 0 additions & 13 deletions src/classes/secrets/TssSecretLookup.class.ps1

This file was deleted.

6 changes: 3 additions & 3 deletions src/functions/secrets/Find-Secret.ps1
Expand Up @@ -22,7 +22,7 @@ function Find-Secret {
Requires TssSession object returned by New-TssSession
#>
[cmdletbinding(DefaultParameterSetName = 'filter')]
[OutputType('TssSecretLookup')]
[OutputType('Thycotic.PowerShell.Secrets.Lookup')]
param(
# TssSession object created by New-TssSession for authentication
[Parameter(Mandatory, ValueFromPipeline, Position = 0)]
Expand Down Expand Up @@ -253,7 +253,7 @@ function Find-Secret {
}

if ($tssParams.ContainsKey('Id') -and $restResponse) {
[TssSecretLookup]@{
[Thycotic.PowerShell.Secrets.Lookup]@{
Id = $restResponse.Id
SecretName = $restResponse.value
}
Expand All @@ -264,7 +264,7 @@ function Find-Secret {
if ($restResponse) {
foreach ($secret in $restResponse.records) {
$parsedValue = $secret.value.Split('-', 3).Trim()
[TssSecretLookup]@{
[Thycotic.PowerShell.Secrets.Lookup]@{
Id = $secret.id
FolderId = $parsedValue[0]
SecretTemplateId = $parsedValue[1]
Expand Down
4 changes: 2 additions & 2 deletions tests/secrets/Find-Secret.Tests.ps1
Expand Up @@ -24,8 +24,8 @@ Describe "$commandName verify parameters" {
}
}
Context "Command specific details" {
It "$commandName should set OutputType to TssSecretLookup" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'TssSecretLookup'
It "$commandName should set OutputType to Thycotic.PowerShell.Secrets.Lookup" -TestCases $commandDetails {
$_.OutputType.Name | Should -Be 'Thycotic.PowerShell.Secrets.Lookup'
}
}
}

0 comments on commit b954371

Please sign in to comment.