summaryrefslogtreecommitdiffstats
path: root/src/plugins/influxdb-writer.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-03-29 15:56:10 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2019-04-01 11:44:53 +0200
commitf6e6432ed03ff76868efe57396036d3124881069 (patch)
treef69013eeb924ce7350de2ceab9b6ae03b1e4f80e /src/plugins/influxdb-writer.c
parentfb1f28adcf1cf90606ac31425e9370edfa9e70c2 (diff)
Git submodule migration to separated libraries
- Replace controller binder functions definition with the binder ones. and remove the last used submodules to use the separated libraries. Bug-AGL: SPEC-2139 Change-Id: I0e354757dec692c13b49f02226fcf891953667f5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/plugins/influxdb-writer.c')
-rw-r--r--src/plugins/influxdb-writer.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/plugins/influxdb-writer.c b/src/plugins/influxdb-writer.c
index e02612d..9090a32 100644
--- a/src/plugins/influxdb-writer.c
+++ b/src/plugins/influxdb-writer.c
@@ -23,29 +23,29 @@
void influxdb_write_curl_cb(void *closure, int status, CURL *curl, const char *result, size_t size)
{
- AFB_ReqT request = (AFB_ReqT)closure;
+ afb_req_t request = (afb_req_t)closure;
long rep_code = curl_wrap_response_code_get(curl);
switch(rep_code) {
case 204:
- AFB_ReqDebug(request, "Request correctly written");
- AFB_ReqSuccess(request, NULL, "Request has been successfully writen");
+ AFB_REQ_DEBUG(request, "Request correctly written");
+ afb_req_success(request, NULL, "Request has been successfully writen");
break;
case 400:
- AFB_ReqFail(request, "Bad request", result);
+ afb_req_fail(request, "Bad request", result);
break;
case 401:
- AFB_ReqFail(request, "Unauthorized access", result);
+ afb_req_fail(request, "Unauthorized access", result);
break;
case 404:
- AFB_ReqFail(request, "Not found", result);
- AFB_ReqNotice(request, "Attempt to create the DB '"DEFAULT_DB"'");
+ afb_req_fail(request, "Not found", result);
+ AFB_REQ_NOTICE(request, "Attempt to create the DB '"DEFAULT_DB"'");
create_database(request);
break;
case 500:
- AFB_ReqFailF(request, "Timeout", "Overloaded server: %s", result);
+ afb_req_fail_f(request, "Timeout", "Overloaded server: %s", result);
break;
default:
- AFB_ReqFail(request, "Failure", "Unexpected behavior.");
+ afb_req_fail(request, "Failure", "Unexpected behavior.");
break;
}
}
@@ -88,7 +88,7 @@ static size_t format_write_args(char *query, struct series_t *serie)
return strlen(query);
}
-CURL *make_curl_write_post(AFB_ApiT apiHandle, const char *url, json_object *metricsJ)
+CURL *make_curl_write_post(afb_api_t apiHandle, const char *url, json_object *metricsJ)
{
CURL *curl = NULL;
size_t lpd = 0, len_write = 0, i = 0;
@@ -114,7 +114,7 @@ CURL *make_curl_write_post(AFB_ApiT apiHandle, const char *url, json_object *met
memset(serie, 0, sizeof(struct series_t));
if(unpack_metric_from_api(json_object_array_get_idx(metricsArrayJ, i), serie)) {
- AFB_ApiError(apiHandle, "ERROR unpacking metric. %s", json_object_to_json_string(metricsArrayJ));
+ AFB_API_ERROR(apiHandle, "ERROR unpacking metric. %s", json_object_to_json_string(metricsArrayJ));
break;
}
else {
@@ -144,7 +144,7 @@ CURL *make_curl_write_post(AFB_ApiT apiHandle, const char *url, json_object *met
return curl;
}
-CURL *influxdb_write(AFB_ApiT apiHandle, const char* host, const char *port, json_object *metricJ)
+CURL *influxdb_write(afb_api_t apiHandle, const char* host, const char *port, json_object *metricJ)
{
char url[URL_MAXIMUM_LENGTH]; /* Safe limit for most popular web browser */
make_url(url, sizeof(url), host, port, "write");
@@ -153,12 +153,12 @@ CURL *influxdb_write(AFB_ApiT apiHandle, const char* host, const char *port, jso
CTLP_CAPI(write_to_influxdb, source, argsJ, eventJ)
{
- AFB_ReqT request = source->request;
+ afb_req_t request = source->request;
const char *port = NULL;
const char *host = NULL;
CURL *curl_request;
- json_object *req_args = AFB_ReqJson(request),
+ json_object *req_args = afb_req_json(request),
*portJ = NULL,
*metric = NULL;
@@ -166,7 +166,7 @@ CTLP_CAPI(write_to_influxdb, source, argsJ, eventJ)
"host", &host,
"port", &portJ,
"metric", &metric) || ! metric)
- AFB_ReqFail(request, "Failed", "Error processing arguments. Miss metric\
+ afb_req_fail(request, "Failed", "Error processing arguments. Miss metric\
JSON object or malformed");
else
port = json_object_is_type(portJ, json_type_null) ?