@@ -222,43 +222,50 @@ private static async Task SetActiveDirectorySecretsAsync(
222222 } , credentials . LeaseId , credentials . LeaseDurationSeconds , credentials . Renewable ) ) ;
223223 }
224224
225- private static async Task SetAzureSecretsAsync ( string key , IVaultClient client ,
226- VaultOptions . LeaseOptions options ,
227- IDictionary < string , string > configuration )
225+ private static async Task SetAzureSecretsAsync (
226+ string key ,
227+ IVaultClient client ,
228+ VaultOptions . LeaseOptions options ,
229+ IDictionary < string , string > configuration )
228230 {
229231 const string name = SecretsEngineMountPoints . Defaults . Azure ;
230- var mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
231- var credentials =
232- await client . V1 . Secrets . Azure . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
232+ string ? mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
233+
234+ var credentials = await client . V1 . Secrets . Azure . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
235+
233236 SetSecrets ( key , options , configuration , name , ( ) => ( credentials , new Dictionary < string , string >
234237 {
235238 [ "clientId" ] = credentials . Data . ClientId ,
236239 [ "clientSecret" ] = credentials . Data . ClientSecret
237240 } , credentials . LeaseId , credentials . LeaseDurationSeconds , credentials . Renewable ) ) ;
238241 }
239242
240- private static async Task SetConsulSecretsAsync ( string key , IVaultClient client ,
241- VaultOptions . LeaseOptions options ,
242- IDictionary < string , string > configuration )
243+ private static async Task SetConsulSecretsAsync (
244+ string key ,
245+ IVaultClient client ,
246+ VaultOptions . LeaseOptions options ,
247+ IDictionary < string , string > configuration )
243248 {
244249 const string name = SecretsEngineMountPoints . Defaults . Consul ;
245- var mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
246- var credentials =
247- await client . V1 . Secrets . Consul . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
250+ string ? mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
251+ var credentials = await client . V1 . Secrets . Consul . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
252+
248253 SetSecrets ( key , options , configuration , name , ( ) => ( credentials , new Dictionary < string , string >
249254 {
250255 [ "token" ] = credentials . Data . Token
251256 } , credentials . LeaseId , credentials . LeaseDurationSeconds , credentials . Renewable ) ) ;
252257 }
253258
254- private static async Task SetDatabaseSecretsAsync ( string key , IVaultClient client ,
255- VaultOptions . LeaseOptions options ,
256- IDictionary < string , string > configuration )
259+ private static async Task SetDatabaseSecretsAsync (
260+ string key ,
261+ IVaultClient client ,
262+ VaultOptions . LeaseOptions options ,
263+ IDictionary < string , string > configuration )
257264 {
258265 const string name = SecretsEngineMountPoints . Defaults . Database ;
259- var mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
260- var credentials =
261- await client . V1 . Secrets . Database . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
266+ string ? mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
267+ var credentials = await client . V1 . Secrets . Database . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
268+
262269 SetSecrets ( key , options , configuration , name , ( ) => ( credentials , new Dictionary < string , string >
263270 {
264271 [ "username" ] = credentials . Data . Username ,
@@ -273,24 +280,29 @@ private static async Task SetPkiSecretsAsync(IVaultClient client, VaultOptions o
273280 CertificatesService . Set ( options . Pki . RoleName , certificate ) ;
274281 }
275282
276- private static async Task SetRabbitMqSecretsAsync ( string key , IVaultClient client ,
277- VaultOptions . LeaseOptions options ,
278- IDictionary < string , string > configuration )
283+ private static async Task SetRabbitMqSecretsAsync (
284+ string key ,
285+ IVaultClient client ,
286+ VaultOptions . LeaseOptions options ,
287+ IDictionary < string , string > configuration )
279288 {
280289 const string name = SecretsEngineMountPoints . Defaults . RabbitMQ ;
281- var mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
282- var credentials =
283- await client . V1 . Secrets . RabbitMQ . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
290+ string ? mountPoint = string . IsNullOrWhiteSpace ( options . MountPoint ) ? name : options . MountPoint ;
291+ var credentials = await client . V1 . Secrets . RabbitMQ . GetCredentialsAsync ( options . RoleName , mountPoint ) ;
292+
284293 SetSecrets ( key , options , configuration , name , ( ) => ( credentials , new Dictionary < string , string >
285294 {
286295 [ "username" ] = credentials . Data . Username ,
287296 [ "password" ] = credentials . Data . Password
288297 } , credentials . LeaseId , credentials . LeaseDurationSeconds , credentials . Renewable ) ) ;
289298 }
290299
291- private static void SetSecrets ( string key , VaultOptions . LeaseOptions options ,
292- IDictionary < string , string > configuration , string name ,
293- Func < ( object , Dictionary < string , string > , string , int , bool ) > lease )
300+ private static void SetSecrets (
301+ string key ,
302+ VaultOptions . LeaseOptions options ,
303+ IDictionary < string , string > configuration ,
304+ string name ,
305+ Func < ( object Credentials , Dictionary < string , string > Values , string LeaseId , int Duration , bool Renewable ) > lease )
294306 {
295307 var createdAt = DateTime . UtcNow ;
296308 var ( credentials , values , leaseId , duration , renewable ) = lease ( ) ;
@@ -299,7 +311,7 @@ private static void SetSecrets(string key, VaultOptions.LeaseOptions options,
299311 LeaseService . Set ( key , leaseData ) ;
300312 }
301313
302- private static ( IVaultClient client , VaultClientSettings settings ) GetClientAndSettings ( VaultOptions options )
314+ private static ( IVaultClient Client , VaultClientSettings Settings ) GetClientAndSettings ( VaultOptions options )
303315 {
304316 var settings = new VaultClientSettings ( options . Url , GetAuthMethod ( options ) ) ;
305317 var client = new VaultClient ( settings ) ;
0 commit comments