Stryong typed keyvault response
This commit is contained in:
		| @@ -1,10 +1,10 @@ | ||||
| using Azure.Security.KeyVault.Secrets; | ||||
| using VaultSharp; | ||||
| using VaultSharp.V1.AuthMethods.Token; | ||||
| using Core.Blueprint.KeyVault.Configuration; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| using System.Net.Http.Json; | ||||
| using VaultSharp; | ||||
| using VaultSharp.Core; | ||||
| using VaultSharp.V1.AuthMethods.Token; | ||||
|  | ||||
| namespace Core.Blueprint.KeyVault; | ||||
|  | ||||
| @@ -67,7 +67,7 @@ public sealed class KeyVaultProvider : IKeyVaultProvider | ||||
|     /// <returns> | ||||
|     /// A <see cref="Tuple"/> containing a status message and a boolean indicating whether the secret was successfully deleted. | ||||
|     /// </returns> | ||||
|     public async ValueTask<Tuple<string, bool>> DeleteSecretAsync(string secretName, CancellationToken cancellationToken) | ||||
|     public async ValueTask<(string Message, bool Deleted)> DeleteSecretAsync(string secretName, CancellationToken cancellationToken) | ||||
|     { | ||||
|         if (environment == "Local") | ||||
|         { | ||||
| @@ -88,7 +88,7 @@ public sealed class KeyVaultProvider : IKeyVaultProvider | ||||
|     /// <summary> | ||||
|     /// Retrieves a secret from Azure Key Vault or HashiCorp Vault. | ||||
|     /// </summary> | ||||
|     public async ValueTask<Tuple<KeyVaultResponse, string?>> GetSecretAsync(string secretName, CancellationToken cancellationToken) | ||||
|     public async ValueTask<(KeyVaultResponse Secret, string? Message)> GetSecretAsync(string secretName, CancellationToken cancellationToken) | ||||
|     { | ||||
|         if (environment == "Local") | ||||
|         { | ||||
| @@ -108,7 +108,7 @@ public sealed class KeyVaultProvider : IKeyVaultProvider | ||||
|             } | ||||
|             catch (VaultSharp.Core.VaultApiException ex) when (ex.HttpStatusCode == System.Net.HttpStatusCode.NotFound) | ||||
|             { | ||||
|                 return new(new KeyVaultResponse(), "Key Not Found"); | ||||
|                 return new(new KeyVaultResponse { }, "Key Not Found"); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -126,7 +126,7 @@ public sealed class KeyVaultProvider : IKeyVaultProvider | ||||
|     /// <summary> | ||||
|     /// Updates an existing secret in Azure Key Vault or HashiCorp Vault. If the secret does not exist, an error is returned. | ||||
|     /// </summary> | ||||
|     public async ValueTask<Tuple<KeyVaultResponse, string>> UpdateSecretAsync(KeyVaultRequest newSecret, CancellationToken cancellationToken) | ||||
|     public async ValueTask<(KeyVaultResponse Secret, string? Message)> UpdateSecretAsync(KeyVaultRequest newSecret, CancellationToken cancellationToken) | ||||
|     { | ||||
|         var existingSecret = await this.GetSecretAsync(newSecret.Name, cancellationToken); | ||||
|         if (!string.IsNullOrEmpty(existingSecret.Item2)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user