Updates for new generated code. Mostly cleanups.
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
cmake_minimum_required (VERSION 2.6...3.10.2)
|
cmake_minimum_required (VERSION 2.6...3.10.2)
|
||||||
project (CGenerator C)
|
project (CGenerator C)
|
||||||
|
|
||||||
|
enable_language(C)
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
cmake_policy(SET CMP0063 NEW)
|
cmake_policy(SET CMP0063 NEW)
|
||||||
|
|
||||||
set(CMAKE_C_VISIBILITY_PRESET default)
|
set(CMAKE_C_VISIBILITY_PRESET default)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ int shc_request(char **p_http_response, int *p_http_response_length, char *type,
|
|||||||
fprintf(stderr, "%s: Cannot create http client. [%s].\n", fname, strerror(errno));
|
fprintf(stderr, "%s: Cannot create http client. [%s].\n", fname, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
apiClient_invoke(http_client, NULL, NULL, NULL, NULL, NULL, contentType, post_data, type);
|
apiClient_invoke(http_client, NULL, NULL, NULL, NULL, NULL, contentType, post_data, strlen(post_data), type);
|
||||||
|
|
||||||
int rc = http_client->response_code;
|
int rc = http_client->response_code;
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#define KUBE_CONFIG_DEFAULT_LOCATION "%s/.kube/config"
|
#define KUBE_CONFIG_DEFAULT_LOCATION "%s/.kube/config"
|
||||||
|
|
||||||
|
int load_kube_config_common(char **pBasePath, sslConfig_t ** pSslConfig, list_t ** pApiKeys, kubeconfig_t * kubeconfig);
|
||||||
|
|
||||||
static int setBasePath(char **pBasePath, char *basePath)
|
static int setBasePath(char **pBasePath, char *basePath)
|
||||||
{
|
{
|
||||||
char *_basePath = strdup(basePath);
|
char *_basePath = strdup(basePath);
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
#include "kube_config_model.h"
|
#include "kube_config_model.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void kubeconfig_free_string_list(char **string_list, int count);
|
||||||
|
void kubeconfig_free_string_map_list(keyValuePair_t ** map_list, int count);
|
||||||
|
|
||||||
|
char *kubeconfig_mk_cert_key_tempfile(const char *data);
|
||||||
|
|
||||||
void kubeconfig_free_string_list(char **string_list, int count)
|
void kubeconfig_free_string_list(char **string_list, int count)
|
||||||
{
|
{
|
||||||
if (string_list && count > 0) {
|
if (string_list && count > 0) {
|
||||||
|
|||||||
@@ -13,6 +13,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "../include/apiClient.h"
|
#include "../include/apiClient.h"
|
||||||
|
|
||||||
|
char *kubeconfig_mk_cert_key_tempfile(const char *data);
|
||||||
|
void unsetSslConfig(sslConfig_t * sslConfig);
|
||||||
|
void clear_and_free_string_pair_list(list_t * list);
|
||||||
|
|
||||||
static bool is_cert_or_key_base64_encoded(const char *data)
|
static bool is_cert_or_key_base64_encoded(const char *data)
|
||||||
{
|
{
|
||||||
if (NULL == strstr(data, "BEGIN")) {
|
if (NULL == strstr(data, "BEGIN")) {
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ mapping :: = MAPPING - START(node node) * MAPPING - END
|
|||||||
|
|
||||||
#define VALUE_TRUE_LOWERCASE_STRING "true"
|
#define VALUE_TRUE_LOWERCASE_STRING "true"
|
||||||
|
|
||||||
|
int append_key_stringseq_to_mapping_node(yaml_document_t * output_document, int parent_node, const char *key_string, char **strings, int strings_count);
|
||||||
|
int append_auth_provider_config_to_mapping_node(yaml_document_t * output_document, int parent_node, const kubeconfig_property_t * auth_provider_config);
|
||||||
|
int append_key_kvpseq_to_mapping_node(yaml_document_t * output_document, int parent_node, const char *key_string, keyValuePair_t ** kvps, int kvps_count);
|
||||||
|
|
||||||
|
|
||||||
static char *load_file_content(const char *path)
|
static char *load_file_content(const char *path)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
#include "../include/generic.h"
|
#include "../include/generic.h"
|
||||||
#include "../include/utils.h"
|
#include "../include/utils.h"
|
||||||
|
|
||||||
|
void makeNamespacedResourcePath(char* path, genericClient_t *client, const char* namespace, const char* name);
|
||||||
|
void makeResourcePath(char* path, genericClient_t *client, const char* name);
|
||||||
|
char* callInternal(genericClient_t *client,
|
||||||
|
const char *path, list_t *queryParameters, list_t *headerParameters, list_t *formParameters, list_t *headerType, list_t *contentType, const char *body, const char *method);
|
||||||
|
char *callSimplifiedInternal(genericClient_t *client, const char *path, const char *method, const char *body);
|
||||||
|
|
||||||
genericClient_t* genericClient_create(apiClient_t *client, const char *apiGroup, const char* apiVersion, const char* resourcePlural) {
|
genericClient_t* genericClient_create(apiClient_t *client, const char *apiGroup, const char* apiVersion, const char* resourcePlural) {
|
||||||
genericClient_t *result = malloc(sizeof(genericClient_t));
|
genericClient_t *result = malloc(sizeof(genericClient_t));
|
||||||
result->client = client;
|
result->client = client;
|
||||||
@@ -54,7 +60,7 @@ void makeResourcePath(char* path, genericClient_t *client, const char* name) {
|
|||||||
char* callInternal(genericClient_t *client,
|
char* callInternal(genericClient_t *client,
|
||||||
const char *path, list_t *queryParameters, list_t *headerParameters, list_t *formParameters, list_t *headerType, list_t *contentType, const char *body, const char *method)
|
const char *path, list_t *queryParameters, list_t *headerParameters, list_t *formParameters, list_t *headerType, list_t *contentType, const char *body, const char *method)
|
||||||
{
|
{
|
||||||
apiClient_invoke(client->client, path, queryParameters, headerParameters, formParameters, headerType, contentType, body, method);
|
apiClient_invoke(client->client, path, queryParameters, headerParameters, formParameters, headerType, contentType, body, strlen(body), method);
|
||||||
|
|
||||||
if (client->client->response_code == 401) {
|
if (client->client->response_code == 401) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user