Files
c/kubernetes/api/LogsAPI.c

125 lines
3.1 KiB
C
Raw Permalink Normal View History

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "LogsAPI.h"
#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
void
LogsAPI_logFileHandler(apiClient_t *apiClient, char *logpath)
{
list_t *localVarQueryParameters = NULL;
list_t *localVarHeaderParameters = NULL;
list_t *localVarFormParameters = NULL;
list_t *localVarHeaderType = NULL;
list_t *localVarContentType = NULL;
char *localVarBodyParameters = NULL;
size_t localVarBodyLength = 0;
// clear the error code from the previous api call
apiClient->response_code = 0;
// create the path
char *localVarPath = strdup("/logs/{logpath}");
if(!logpath)
goto end;
// Path Params
long sizeOfPathParams_logpath = strlen(logpath)+3 + sizeof("{ logpath }") - 1;
if(logpath == NULL) {
goto end;
}
char* localVarToReplace_logpath = malloc(sizeOfPathParams_logpath);
sprintf(localVarToReplace_logpath, "{%s}", "logpath");
localVarPath = strReplace(localVarPath, localVarToReplace_logpath, logpath);
apiClient_invoke(apiClient,
localVarPath,
localVarQueryParameters,
localVarHeaderParameters,
localVarFormParameters,
localVarHeaderType,
localVarContentType,
localVarBodyParameters,
localVarBodyLength,
"GET");
// uncomment below to debug the error response
//if (apiClient->response_code == 401) {
// printf("%s\n","Unauthorized");
//}
//No return type
end:
if (apiClient->dataReceived) {
free(apiClient->dataReceived);
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}
free(localVarPath);
free(localVarToReplace_logpath);
}
void
LogsAPI_logFileListHandler(apiClient_t *apiClient)
{
list_t *localVarQueryParameters = NULL;
list_t *localVarHeaderParameters = NULL;
list_t *localVarFormParameters = NULL;
list_t *localVarHeaderType = NULL;
list_t *localVarContentType = NULL;
char *localVarBodyParameters = NULL;
size_t localVarBodyLength = 0;
// clear the error code from the previous api call
apiClient->response_code = 0;
// create the path
char *localVarPath = strdup("/logs/");
apiClient_invoke(apiClient,
localVarPath,
localVarQueryParameters,
localVarHeaderParameters,
localVarFormParameters,
localVarHeaderType,
localVarContentType,
localVarBodyParameters,
localVarBodyLength,
"GET");
// uncomment below to debug the error response
//if (apiClient->response_code == 401) {
// printf("%s\n","Unauthorized");
//}
//No return type
end:
if (apiClient->dataReceived) {
free(apiClient->dataReceived);
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
}
free(localVarPath);
}