protected override void EndProcessing()
 {
     try
     {
         RegisteredVaultCache.SetDefaultVault(Name);
     }
     catch (Exception ex)
     {
         ThrowTerminatingError(
             new ErrorRecord(
                 exception: ex,
                 errorId: "VaultNotFound",
                 errorCategory: ErrorCategory.ObjectNotFound,
                 this));
     }
 }
Exemplo n.º 2
0
        protected override void EndProcessing()
        {
            if (!ShouldProcess(Name, "Set vault as default"))
            {
                return;
            }

            string vaultName;

            switch (ParameterSetName)
            {
            case NameParameterSet:
                vaultName = Name;
                break;

            case SecretVaultParameterSet:
                vaultName = SecretVault.Name;
                break;

            default:
                Dbg.Assert(false, "Invalid parameter set");
                vaultName = string.Empty;
                break;
            }

            try
            {
                RegisteredVaultCache.SetDefaultVault(vaultName);
            }
            catch (Exception ex)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        exception: ex,
                        errorId: "VaultNotFound",
                        errorCategory: ErrorCategory.ObjectNotFound,
                        this));
            }
        }