Source
if (SUCCEED != zbx_http_get(url, header, timeout, ssl_cert_file, ssl_key_file, &out, &response_code, error))
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
int zbx_hashicorp_kvs_get(const char *vault_url, const char *token, const char *ssl_cert_file,
const char *ssl_key_file, const char *path, long timeout, zbx_kvs_t *kvs, char **error)
{
ZBX_UNUSED(vault_url);
ZBX_UNUSED(token);
ZBX_UNUSED(ssl_cert_file);
ZBX_UNUSED(ssl_key_file);
ZBX_UNUSED(path);
ZBX_UNUSED(timeout);
ZBX_UNUSED(kvs);
*error = zbx_dsprintf(*error, "missing cURL library");
return FAIL;
char *out = NULL, *url, header[MAX_STRING_LEN], *left, *right;
struct zbx_json_parse jp, jp_data, jp_data_data;
int ret = FAIL;
long response_code;
if (NULL == token)
{
*error = zbx_dsprintf(*error, "\"VaultToken\" configuration parameter or \"VAULT_TOKEN\" environment"
" variable should be defined");
return FAIL;
}
zbx_strsplit_first(path, '/', &left, &right);
if (NULL == right)
{
*error = zbx_dsprintf(*error, "cannot find separator \"\\\" in path");
free(left);
return FAIL;
}
url = zbx_dsprintf(NULL, "%s/v1/%s/data/%s", vault_url, left, right);
zbx_free(right);
zbx_free(left);