Skip to content

Commit

Permalink
Filter the null values from the Json response while converting it to …
Browse files Browse the repository at this point in the history
…Thycotic.PowerShell.SecretPolicies.Policy
  • Loading branch information
Gaurav Agrawal authored and delineaKrehl committed Sep 8, 2022
1 parent 6d7268a commit 4900d8a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/functions/secret-policies/Get-TssSecretPolicy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ function Get-TssSecretPolicy {
}

if ($restResponse) {
[Thycotic.PowerShell.SecretPolicies.Policy[]]$restResponse
# Ignore the nuull values while converting it to Thycotic.PowerShell.SecretPolicies
$restResponse | ForEach-Object {
$NonEmptyProperties = $_.restResponse.Properties | Where-Object {$_.Value} | Select-Object -ExpandProperty Name
$_ | Select-Object -Property $NonEmptyProperties
}
[Thycotic.PowerShell.SecretPolicies.Policy[]]$NonEmptyProperties
}
}
} else {
Expand Down

0 comments on commit 4900d8a

Please sign in to comment.