classes/secrets/TssSecret.class.ps1
class TssSecret { [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '', Scope = 'Class')] [int] $AccessRequestWorkflowMapId [boolean] $Active [boolean] $AllowOwnersUnrestrictedSshCommands [boolean] $AutoChangeEnabled [string] $AutoChangeNextPassword [boolean] $CheckedOut [boolean] $CheckOutChangePasswordEnabled [boolean] $CheckOutEnabled [int] $CheckOutIntervalMinutes [int] $CheckOutMinutesRemaining [string] $CheckOutUserDisplayName [int] $CheckOutUserId [int] $DoubleLockId [boolean] $EnableInheritPermissions [boolean] $EnableInheritSecretPolicy [int] $FailedPasswordChangeAttempts [int] $FolderId [int] $Id [boolean] $IsDoubleLock [boolean] $IsOutOfSync [boolean] $IsRestricted [TssSecretItem[]] $Items [datetime] $LastHeartBeatCheck [ValidateSet('Failed','Success','Pending','Disabled','UnableToConnect','UnknownError','IncompatibleHost','AccountLockedOut','DnsMismatch','UnableToValidateServerPublicKey','Processing','ArgumentError','AccessDenied')] [string] $LastHeartBeatStatus [datetime] $LastPasswordChangeAttempt [int] $LauncherConnectAsSecretId [string] $Name [string] $OutOfSyncReason [int] $PasswordTypeWebScriptId [boolean] $ProxyEnabled [boolean] $RequiresApprovalForAccess [boolean] $RequiresComment [boolean] $RestrictSshCommands [int] $SecretPolicyId [int] $SecretTemplateId [string] $SecretTemplateName [boolean] $SessionRecordingEnabled [int] $SiteId [boolean] $WebLauncherRequiresIncognitoMode hidden [string[]] $ResponseCodes [System.Management.Automation.PSCredential] GetCredential() { $username = ($this.Items | Where-Object FieldName -EQ 'username').ItemValue $passwd = ($this.Items | Where-Object IsPassword).ItemValue return [pscredential]::new($username,(ConvertTo-SecureString -AsPlainText -Force -String $passwd)) } [System.String] GetFieldValue([string]$Slug) { $value = $this.Items.Where( { $_.Slug -eq $Slug }).ItemValue return $value } [void] SetFieldValue([string]$Slug,$NewValue) { foreach ($i in $this.Items) { if ($i.Slug -eq $Slug) { $i.ItemValue = $NewValue } } } } |