Muhammad Farooq
Muhammad Farooq

Reputation: 1

How to get all Leases or Http Client from VaultSharp?

I am using HashiCorp Vault 1.10.0 to maintain secrets and for this, I am using VaultSharp in C# .Net Core 6.0.

I am new to VaultSharp and I have ask about it that how can I get Leases from the VaultSharp (I tried but not able to find such functionality in the the VaulSharp), in case, if there is no such functionality then is there any way to get Its HttpClient, so that I could pass the Lease API URL?

And here is the scenario why do I need this?

I am generating the dynamic DB credentials from the Vault and therefore I need to know when they are going to expired, for this reason I need to know its lease information that tells us its creation and expiration time.

Otherwise, I have to create a new Httpclient that will call the Hashicorp Vault API and gets the Leases from it but I want to use VaultSharp to maintain consistency.

Please advise.

Thank you.

Upvotes: 0

Views: 219

Answers (1)

Muhammad Farooq
Muhammad Farooq

Reputation: 1

Thanks, I have resolved the issue by

var res = await VaultClient.V1.System.GetLeaseAsync(dbCreds.LeaseId);

Upvotes: 0

Related Questions