Skip to content

Commit

Permalink
Search-TssWorkflowTemplate - convert Type param to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Oct 27, 2021
1 parent 658106f commit 6e98c79
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Search Workflow Templates
## SYNTAX

```
Search-TssWorkflowTemplate [-TssSession] <Session> [-IncludeInactive] [-Type <String>] [-SortBy <String>]
[<CommonParameters>]
Search-TssWorkflowTemplate [-TssSession] <Session> [-IncludeInactive] [-Type <WorkflowTypes>]
[-SortBy <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -59,9 +59,10 @@ Accept wildcard characters: False
Workflow Type (AccessRequest, SecretEraseRequest)
```yaml
Type: String
Type: WorkflowTypes
Parameter Sets: (All)
Aliases:
Accepted values: AccessRequest, SecretEraseRequest

Required: False
Position: Named
Expand Down
13 changes: 13 additions & 0 deletions src/Thycotic.SecretServer/enums/workflows/WorkflowType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;

namespace Thycotic.PowerShell.Enums
{
public enum WorkflowTypes
{
AccessRequest,
SecretEraseRequest
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ function Search-TssWorkflowTemplate {
$IncludeInactive,

# Workflow Type (AccessRequest, SecretEraseRequest)
[Parameter()]
[ValidateSet('AccessRequest','SecretEraseRequest')]
[string]
[Thycotic.PowerShell.Enums.WorkflowTypes]
$Type,

# Sort by specific property, default Name
Expand All @@ -57,7 +55,7 @@ function Search-TssWorkflowTemplate {
$uri = $uri, "filter.includeInactive=$([boolean]$IncludeInactive)" -join '&'

if ($tssParams.ContainsKey('Type')) {
$uri = $uri, "filter.workflowType=$Type" -join '&'
$uri = $uri, "filter.workflowType=$([string]$Type)" -join '&'
}
$invokeParams.Uri = $uri
$invokeParams.Method = 'GET'
Expand Down

0 comments on commit 6e98c79

Please sign in to comment.