int zbx_hashicorp_kvs_get(const char *vault_url, const char *prefix, const char *token, const char *ssl_cert_file,
const char *ssl_key_file, const char *config_source_ip, const char *config_ssl_ca_location,
const char *config_ssl_cert_location, const char *config_ssl_key_location, const char *path,
long timeout, zbx_kvs_t *kvs, char **error)
ZBX_UNUSED(ssl_cert_file);
ZBX_UNUSED(ssl_key_file);
ZBX_UNUSED(config_source_ip);
ZBX_UNUSED(config_ssl_ca_location);
ZBX_UNUSED(config_ssl_cert_location);
ZBX_UNUSED(config_ssl_key_location);
*error = zbx_dsprintf(*error, "missing cURL library");
char *out = NULL, *url, header[MAX_STRING_LEN], *left, *right;
struct zbx_json_parse jp, jp_data, jp_data_data;
*error = zbx_dsprintf(*error, "\"VaultToken\" configuration parameter or \"VAULT_TOKEN\" environment"
" variable should be defined");
if (NULL == prefix || '\0' == *prefix)
zbx_strsplit_first(path, '/', &left, &right);
*error = zbx_dsprintf(*error, "cannot find separator \"\\\" in path");
url = zbx_dsprintf(NULL, "%s/v1/%s/data/%s", vault_url, left, right);
url = zbx_dsprintf(NULL, "%s%s%s", vault_url, prefix, path);
zbx_snprintf(header, sizeof(header), "X-Vault-Token: %s", token);
if (SUCCEED != zbx_http_req(url, header, timeout, ssl_cert_file, ssl_key_file, config_source_ip,
config_ssl_ca_location, config_ssl_cert_location, config_ssl_key_location, &out, NULL,
if (200 != response_code && 204 != response_code)
*error = zbx_dsprintf(*error, "unsuccessful response code \"%ld\"", response_code);
if (SUCCEED != zbx_json_open(out, &jp))