From b95437193a001ef897130bef4c4d035c6e221571 Mon Sep 17 00:00:00 2001 From: Shawn Melton <11204251+wsmelton@users.noreply.github.com> Date: Tue, 20 Jul 2021 14:36:52 -0500 Subject: [PATCH] TssSecretLookup - migrate and update --> Thycotic.PowerShell.Secrets.Lookup --- .../about_topics/secrets/about_tsssecretlookup.md | 10 +++++----- docs/commands/secrets/Find-TssSecret.md | 2 +- src/Thycotic.SecretServer.Types.ps1xml | 2 +- .../classes/secrets/Lookup.cs | 15 +++++++++++++++ src/classes/secrets/TssSecretLookup.class.ps1 | 13 ------------- src/functions/secrets/Find-Secret.ps1 | 6 +++--- tests/secrets/Find-Secret.Tests.ps1 | 4 ++-- 7 files changed, 27 insertions(+), 25 deletions(-) create mode 100644 src/Thycotic.SecretServer/classes/secrets/Lookup.cs delete mode 100644 src/classes/secrets/TssSecretLookup.class.ps1 diff --git a/docs/about_topics/secrets/about_tsssecretlookup.md b/docs/about_topics/secrets/about_tsssecretlookup.md index 66320edb..41ddfa5e 100644 --- a/docs/about_topics/secrets/about_tsssecretlookup.md +++ b/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": - "value: " - - + "value: " - - This class is revising this to output the items in the value as proper properties (handled by the calling function). # CONSTRUCTORS diff --git a/docs/commands/secrets/Find-TssSecret.md b/docs/commands/secrets/Find-TssSecret.md index 0d77f7cf..dfc51bef 100644 --- a/docs/commands/secrets/Find-TssSecret.md +++ b/docs/commands/secrets/Find-TssSecret.md @@ -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 diff --git a/src/Thycotic.SecretServer.Types.ps1xml b/src/Thycotic.SecretServer.Types.ps1xml index f4694810..7a66fb4a 100644 --- a/src/Thycotic.SecretServer.Types.ps1xml +++ b/src/Thycotic.SecretServer.Types.ps1xml @@ -129,7 +129,7 @@ - TssSecretLookup + Thycotic.PowerShell.Secrets.Lookup SecretId diff --git a/src/Thycotic.SecretServer/classes/secrets/Lookup.cs b/src/Thycotic.SecretServer/classes/secrets/Lookup.cs new file mode 100644 index 00000000..23ac1b9e --- /dev/null +++ b/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; } + } +} \ No newline at end of file diff --git a/src/classes/secrets/TssSecretLookup.class.ps1 b/src/classes/secrets/TssSecretLookup.class.ps1 deleted file mode 100644 index 4d61fe1b..00000000 --- a/src/classes/secrets/TssSecretLookup.class.ps1 +++ /dev/null @@ -1,13 +0,0 @@ -class TssSecretLookup { - [int] - $Id - - [int] - $FolderId - - [int] - $SecretTemplateId - - [string] - $SecretName -} \ No newline at end of file diff --git a/src/functions/secrets/Find-Secret.ps1 b/src/functions/secrets/Find-Secret.ps1 index 9b5677bd..073e08ba 100644 --- a/src/functions/secrets/Find-Secret.ps1 +++ b/src/functions/secrets/Find-Secret.ps1 @@ -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)] @@ -253,7 +253,7 @@ function Find-Secret { } if ($tssParams.ContainsKey('Id') -and $restResponse) { - [TssSecretLookup]@{ + [Thycotic.PowerShell.Secrets.Lookup]@{ Id = $restResponse.Id SecretName = $restResponse.value } @@ -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] diff --git a/tests/secrets/Find-Secret.Tests.ps1 b/tests/secrets/Find-Secret.Tests.ps1 index ac72bbc7..ff704d22 100644 --- a/tests/secrets/Find-Secret.Tests.ps1 +++ b/tests/secrets/Find-Secret.Tests.ps1 @@ -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' } } } \ No newline at end of file