Skip to content

Commit

Permalink
HeartbeatStatus enum - adjust params and property to use enumerator
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmelton committed Oct 26, 2021
1 parent d090d7d commit 45f3fb4
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 19 deletions.
12 changes: 7 additions & 5 deletions docs/commands/secrets/Find-TssSecret.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ Find a secret
```
Find-TssSecret [-TssSession] <Session> [-Id <Int32>] [-FolderId <Int32>] [-IncludeSubFolders] [-Field <String>]
[-FieldText <String>] [-ExactMatch] [-FieldSlug <String>] [-ExtendedField <String[]>]
[-ExtendedTypeId <Int32>] [-SecretTemplateId <Int32>] [-SiteId <Int32>] [-HeartbeatStatus <String>]
[-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe] [-PasswordTypeIds <Int32[]>]
[-Permission <String>] [-Scope <String>] [-ExcludeDoubleLock] [-DoubleLockId <Int32>] [<CommonParameters>]
[-ExtendedTypeId <Int32>] [-SecretTemplateId <Int32>] [-SiteId <Int32>]
[-HeartbeatStatus <SecretHeartbeatStatus>] [-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe]
[-PasswordTypeIds <Int32[]>] [-Permission <String>] [-Scope <String>] [-ExcludeDoubleLock]
[-DoubleLockId <Int32>] [<CommonParameters>]
```

### secret
```
Find-TssSecret [-TssSession] <Session> [-Id <Int32>] [-SecretTemplateId <Int32>] [-SiteId <Int32>]
[-HeartbeatStatus <String>] [-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe]
[-HeartbeatStatus <SecretHeartbeatStatus>] [-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe]
[-PasswordTypeIds <Int32[]>] [-ExcludeDoubleLock] [-DoubleLockId <Int32>] [<CommonParameters>]
```

Expand Down Expand Up @@ -233,9 +234,10 @@ Accept wildcard characters: False
Return only secrets with a certain heartbeat status
```yaml
Type: String
Type: SecretHeartbeatStatus
Parameter Sets: filter, secret
Aliases:
Accepted values: Failed, Success, Pending, Disabled, UnableToConnect, UnknownError, IncompatibleHost, AccountLockedOut, DnsMismatch, UnableToValidateServerPublicKey, Processing, ArgumentError, AccessDenied

Required: False
Position: Named
Expand Down
13 changes: 7 additions & 6 deletions docs/commands/secrets/Search-TssSecret.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Search for a secret
```
Search-TssSecret [-TssSession] <Session> [-FolderId <Int32>] [-IncludeSubFolders] [-Field <String>]
[-SearchText <String>] [-ExactMatch] [-FieldSlug <String>] [-ExtendedField <String[]>]
[-ExtendedTypeId <Int32>] [-SecretTemplateId <Int32>] [-SiteId <Int32>] [-HeartbeatStatus <String>]
[-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe] [-PasswordTypeIds <Int32[]>]
[-Permission <String>] [-Scope <String>] [-ExcludeDoubleLock] [-DoubleLockId <Int32>] [-SortBy <String>]
[<CommonParameters>]
[-ExtendedTypeId <Int32>] [-SecretTemplateId <Int32>] [-SiteId <Int32>]
[-HeartbeatStatus <SecretHeartbeatStatus>] [-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe]
[-PasswordTypeIds <Int32[]>] [-Permission <String>] [-Scope <String>] [-ExcludeDoubleLock]
[-DoubleLockId <Int32>] [-SortBy <String>] [<CommonParameters>]
```

### folder
Expand All @@ -31,7 +31,7 @@ Search-TssSecret [-TssSession] <Session> [-Field <String>] [-SearchText <String>
### secret
```
Search-TssSecret [-TssSession] <Session> [-SecretTemplateId <Int32>] [-SiteId <Int32>]
[-HeartbeatStatus <String>] [-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe]
[-HeartbeatStatus <SecretHeartbeatStatus>] [-IncludeInactive] [-ExcludeActive] [-RpcEnabled] [-SharedWithMe]
[-PasswordTypeIds <Int32[]>] [-ExcludeDoubleLock] [-DoubleLockId <Int32>] [-SortBy <String>]
[<CommonParameters>]
```
Expand Down Expand Up @@ -262,9 +262,10 @@ Accept wildcard characters: False
Return only secrets with a certain heartbeat status
```yaml
Type: String
Type: SecretHeartbeatStatus
Parameter Sets: filter, secret
Aliases:
Accepted values: Failed, Success, Pending, Disabled, UnableToConnect, UnknownError, IncompatibleHost, AccountLockedOut, DnsMismatch, UnableToValidateServerPublicKey, Processing, ArgumentError, AccessDenied

Required: False
Position: Named
Expand Down
3 changes: 2 additions & 1 deletion src/Thycotic.SecretServer/classes/secrets/HeartbeatStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Thycotic.PowerShell.Enums;

namespace Thycotic.PowerShell.Secrets
{
public class HeartbeatStatus
{
public string Status { get; set; }
public HeartbeatStatus Status { get; set; }
public DateTime? LastHeartbeatCheck { get; set; }
}
}
3 changes: 2 additions & 1 deletion src/Thycotic.SecretServer/classes/secrets/Secret.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Thycotic.PowerShell.Enums;

namespace Thycotic.PowerShell.Secrets
{
Expand Down Expand Up @@ -32,7 +33,7 @@ public class Secret
public bool IsRestricted { get; set; }
public Items[] Items { get; set; }
public DateTime? LastHeartBeatCheck { get; set; }
public string LastHeartBeatStatus { get; set; }
public HeartbeatStatus LastHeartBeatStatus { get; set; }
public DateTime? LastPasswordChangeAttempt { get; set; }
public int LauncherConnectAsSecretId { get; set; }
public string Name { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion src/Thycotic.SecretServer/classes/secrets/Summary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Thycotic.PowerShell.Enums;

namespace Thycotic.PowerShell.Secrets
{
Expand All @@ -23,7 +24,7 @@ public class Summary
public string OutOfSyncReason { get; set; }
public bool IsRestricted { get; set; }
public DateTime? LastAccessed { get; set; }
public string LastHeartbeatStatus { get; set; }
public SecretHeartbeatStatus LastHeartbeatStatus { get; set; }
public DateTime? LastPasswordChangeAttempt { get; set; }
public string Name { get; set; }
public bool RequiresApproval { get; set; }
Expand Down
24 changes: 24 additions & 0 deletions src/Thycotic.SecretServer/enums/secrets/HeartbeatStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Threading.Tasks;
using System.Management.Automation;
using System.Management.Automation.Runspaces;

namespace Thycotic.PowerShell.Enums
{
public enum SecretHeartbeatStatus
{
Failed = 0,
Success = 1,
Pending = 2,
Disabled = 3,
UnableToConnect = 4,
UnknownError = 5,
IncompatibleHost = 6,
AccountLockedOut = 7,
DnsMismatch = 8,
UnableToValidateServerPublicKey = 9,
Processing = 10,
ArgumentError = 11,
AccessDenied = 12
}
}
1 change: 0 additions & 1 deletion src/functions/rpc/Get-TssRpcAssociatedSecret.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function Get-TssRpcAssociatedSecret {
$tssParams = $PSBoundParameters
$invokeParams = . $GetInvokeApiParams $TssSession
}

process {
Write-TssInternalNote $PSCmdlet.MyInvocation
Get-TssInvocation $PSCmdlet.MyInvocation
Expand Down
6 changes: 4 additions & 2 deletions src/functions/secrets/Find-TssSecret.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ function Find-TssSecret {
# Return only secrets with a certain heartbeat status
[Parameter(ParameterSetName = 'filter')]
[Parameter(ParameterSetName = 'secret')]
[ValidateSet('Failed', 'Success', 'Pending', 'Disabled', 'UnableToConnect', 'UnknownError', 'IncompatibleHost', 'AccountLockedOut', 'DnsMismatch', 'UnableToValidateServerPublicKey', 'Processing', 'ArgumentError', 'AccessDenied')]
[string]
[Thycotic.PowerShell.Enums.SecretHeartbeatStatus]
$HeartbeatStatus,

# Include inactive/disabled secrets
Expand Down Expand Up @@ -193,6 +192,9 @@ function Find-TssSecret {
'ExactMatch' {
$filters += "filter.isExactmatch=$($tssParams['ExactMatch'])"
}
'HeartbeatStatus' {
$filters += "filter.heartbeatStatus=$([string]$HeartbeatStatus)"
}
'ExtendedField' {
foreach ($v in $tssParams['ExtendedField']) {
$filters += "filter.extendedField=$v"
Expand Down
6 changes: 4 additions & 2 deletions src/functions/secrets/Search-TssSecret.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ function Search-TssSecret {
# Return only secrets with a certain heartbeat status
[Parameter(ParameterSetName = 'filter')]
[Parameter(ParameterSetName = 'secret')]
[ValidateSet('Failed', 'Success', 'Pending', 'Disabled', 'UnableToConnect', 'UnknownError', 'IncompatibleHost', 'AccountLockedOut', 'DnsMismatch', 'UnableToValidateServerPublicKey', 'Processing', 'ArgumentError', 'AccessDenied')]
[string]
[Thycotic.PowerShell.Enums.SecretHeartbeatStatus]
$HeartbeatStatus,

# Include inactive/disabled secrets
Expand Down Expand Up @@ -214,6 +213,9 @@ function Search-TssSecret {
'SearchText' {
$filters += "filter.searchText=$($tssParams['SearchText'])"
}
'HeartbeatStatus' {
$filters += "filter.heartbeatStatus=$([string]$HeartbeatStatus)"
}
'ExactMatch' {
$filters += "filter.isExactmatch=$($tssParams['ExactMatch'])"
}
Expand Down

0 comments on commit 45f3fb4

Please sign in to comment.