Exemplo n.º 1
0
        /// <summary>
        /// Internal constructor used by KeyVaultDataServiceClient
        /// </summary>
        /// <param name="clientSecret">secret returned from service</param>
        /// <param name="vaultUriHelper">helper class</param>
        internal Secret(Client.Secret clientSecret, VaultUriHelper vaultUriHelper)
        {
            if (clientSecret == null)
            {
                throw new ArgumentNullException("clientSecret");
            }

            SetObjectIdentifier(vaultUriHelper, new Client.SecretIdentifier(clientSecret.Id));
            SecretValue = clientSecret.SecureValue;

            Id = clientSecret.Id;
        }
        public Secret DeleteSecret(string vaultName, string secretName)
        {
            if (string.IsNullOrEmpty(vaultName))
            {
                throw new ArgumentNullException("vaultName");
            }
            if (string.IsNullOrEmpty(secretName))
            {
                throw new ArgumentNullException("secretName");
            }

            string vaultAddress = this.vaultUriHelper.CreateVaultAddress(vaultName);

            Client.Secret clientSecret = this.keyVaultClient.DeleteSecretAsync(vaultAddress, secretName).GetAwaiter().GetResult();

            return(new Secret(clientSecret, this.vaultUriHelper));
        }