rajanadar / VaultSharp

A comprehensive cross-platform .NET Library for HashiCorp's Vault, a secret management tool
http://rajanadar.github.io/VaultSharp
Apache License 2.0
493 stars 134 forks source link

VaultSharp.V1.SecretsEngines.Database.Role object has no db_name property #344

Closed dwmyersjr closed 2 months ago

dwmyersjr commented 8 months ago

Describe the bug When trying to use CreateRoleAsync to create a new MySQL role, the role is created, but db_name defaults to mysql.

VaultSharp Version 1.13.01 I had also tried with the earlier 1.12.2.1

Vault Version Unknown

Does this work with Vault CLI? Yes

Sample Code Snippet VaultSharp.V1.SecretsEngines.Database.Role oRole = new VaultSharp.V1.SecretsEngines.Database.Role() { DatabaseProviderType = VaultSharp.V1.SecretsEngines.Database.DatabaseProviderType.MySQL , DefaultTimeToLive = sDefaultTTL , MaximumTimeToLive = sMaxTTL , RevocationStatements = sRevocation , CreationStatements = sCreationStatement
}; Task oTask = oVault.V1.Secrets.Database.CreateRoleAsync( sRoleName , oRole);

Exception Details/Stack Trace/Error Message No errors, but the resulting new role has db_name showing as mysql in the vault UI. While roles created through CLI have proper name of the connection. Note that the VaultSharp.V1.SecretsEngines.Database.Role object passed has no db_name property definition.

Any additional info The library is very nice to work with, though some documentation could use more detail/clarification.

Thanks

rajanadar commented 2 months ago

@dwmyersjr, you can use the following snippet to set custom name. I have strongly typed fields for convenience but you can always use custom names

DatabaseProviderType = new DatabaseProviderType("custom_name")