Closed leodlsrt closed 3 years ago
I just took a look and found two unique issues that cause this. The first is a simple bug where the variant of HttpConsumer::put
being used actually uses the POST
method. That's evident in the console output above and was an error in the initial implementation. The next, and larger issue, is in part due to the way your example is constructing Vault::Parameters
, and in total a missing part of the library. Vault::Parameters
is specialized to std::unordered_map<std::string, std::string>
, which doesn't support complex parameters. Since this particular Vault endpoint requires complex parameters, it will need to be supported.
After this is fixed, your code should follow this pattern for parameter construction
Vault::Parameters params {
{"type", "file"},
{"options", {
{"file_path", "log"}
}
};
The reason for your error was that you were constructing a map with a key name the full JSON string literal and a value of an empty string.
In this particular case, I'll add a direct fix for a complex parameter type and avoid any major breaking changes to the library, but upon looking, it will probably be a good idea to leave the full power of the map template in the Parameters
alias. This will be a pretty major breaking change and force a fair amount of refactoring, so I'll save that for another changeset.
This has been fixed in release 0.36.0
. A full working example is at https://github.com/abedra/libvault/blob/master/example/administration/audit/example.cpp
Hi, I've a problem when i want to enable an audit of type "file", i don't know if it comes from my code or from the library...
When I trying via CURL, this works
Result in Vault Server Console :
But when I try this with the C++ library, it gives me a 400 Bad Request "enable audit mount failed: path=file/ error="unknown backend type: """
This is my code :
Result in C++ Console :
Result in Vault Server Console :
Thanks for you response