Fix the issue of parsing json string of kubernetes secret

This commit is contained in:
Hui Yu
2021-07-21 22:41:29 +08:00
parent d83ca5a13a
commit 63d8c15564
33 changed files with 194 additions and 81 deletions

View File

@@ -9,6 +9,7 @@ all:
cd watch_list_pod; make
cd multi_thread; make
cd exec_pod; make
cd list_secret; make
clean:
cd create_pod; make clean
@@ -21,11 +22,13 @@ clean:
cd watch_list_pod; make clean
cd multi_thread; make clean
cd exec_pod; make clean
cd list_secret; make clean
test:
cd create_pod; make test; sleep 10
cd list_pod; make test
cd delete_pod; make test
cd list_secret; make test
cd generic; make test
cd multi_thread; make test; sleep 10
kubectl describe po test-pod-8

1
examples/list_secret/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
list_secret_bin

View File

@@ -0,0 +1,11 @@
INCLUDE:=-I../../kubernetes/include -I../../kubernetes/model -I../../kubernetes/api -I../../kubernetes/config
LIBS:=-L../../kubernetes/build -lkubernetes -lyaml -lwebsockets -L/usr/local/lib
CFLAGS:=-g
BIN:=list_secret_bin
all:
gcc main.c $(CFLAGS) $(INCLUDE) $(LIBS) -o $(BIN)
clean:
rm ./$(BIN)
test:
./$(BIN)

View File

@@ -0,0 +1,80 @@
#include <kube_config.h>
#include <apiClient.h>
#include <CoreV1API.h>
#include <malloc.h>
#include <stdio.h>
#include <errno.h>
void list_secret(apiClient_t * apiClient)
{
v1_secret_list_t *secret_list = CoreV1API_listNamespacedSecret(apiClient,
"default", // char *namespace
"true", // char *pretty
0, // int allowWatchBookmarks
NULL, // char * _continue
NULL, // char * fieldSelector
NULL, // char * labelSelector
0, // int limit
NULL, // char * resourceVersion
0, // int timeoutSeconds
0 //int watch
);
printf("The return code of HTTP request=%ld\n", apiClient->response_code);
if (200 == apiClient->response_code) {
printf("List the secrets successfully.\n");
} else {
fprintf(stderr, "Failed to list the secrets.\n");
return;
}
if (secret_list && secret_list->items) {
listEntry_t *secret_list_entry = NULL;
v1_secret_t *secret = NULL;
list_ForEach(secret_list_entry, secret_list->items) {
secret = secret_list_entry->data;
printf("\tThe secret name: %s\n", secret->metadata->name);
listEntry_t *data_entry = NULL;
keyValuePair_t *pair = NULL;
list_ForEach(data_entry, secret->data) {
pair = data_entry->data;
printf("\tkey=%s, value=%s\n", pair->key, (char *) pair->value);
}
}
v1_secret_list_free(secret_list);
secret_list = NULL;
} else {
fprintf(stderr, "The secret list is invalid.\n");
}
}
int main(int argc, char *argv[])
{
char *basePath = NULL;
sslConfig_t *sslConfig = NULL;
list_t *apiKeys = NULL;
int rc = load_kube_config(&basePath, &sslConfig, &apiKeys, NULL); /* NULL means loading configuration from $HOME/.kube/config */
if (rc != 0) {
fprintf(stderr, "Cannot load kubernetes configuration.\n");
return -1;
}
apiClient_t *apiClient = apiClient_create_with_base_path(basePath, sslConfig, apiKeys);
if (!apiClient) {
fprintf(stderr, "Cannot create a kubernetes client.\n");
return -1;
}
list_secret(apiClient);
apiClient_free(apiClient);
apiClient = NULL;
free_client_config(basePath, sslConfig, apiKeys);
basePath = NULL;
sslConfig = NULL;
apiKeys = NULL;
apiClient_unsetupGlobalEnv();
return 0;
}

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ca_bundle** | **char** | &#x60;caBundle&#x60; is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**ca_bundle** | **char \*** | &#x60;caBundle&#x60; is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**service** | [**admissionregistration_v1_service_reference_t**](admissionregistration_v1_service_reference.md) \* | | [optional]
**url** | **char \*** | &#x60;url&#x60; gives the location of the webhook, in standard URL form (&#x60;scheme://host:port/path&#x60;). Exactly one of &#x60;url&#x60; or &#x60;service&#x60; must be specified. The &#x60;host&#x60; should not refer to a service running in the cluster; use the &#x60;service&#x60; field instead. The host might be resolved via external DNS in some apiservers (e.g., &#x60;kube-apiserver&#x60; cannot resolve in-cluster DNS as that would be a layering violation). &#x60;host&#x60; may also be an IP address. Please note that using &#x60;localhost&#x60; or &#x60;127.0.0.1&#x60; as a &#x60;host&#x60; is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. The scheme must be \&quot;https\&quot;; the URL must begin with \&quot;https://\&quot;. A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. Attempting to use a user or basic auth e.g. \&quot;user:password@\&quot; is not allowed. Fragments (\&quot;#...\&quot;) and query parameters (\&quot;?...\&quot;) are not allowed, either. | [optional]

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ca_bundle** | **char** | &#x60;caBundle&#x60; is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**ca_bundle** | **char \*** | &#x60;caBundle&#x60; is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**service** | [**admissionregistration_v1beta1_service_reference_t**](admissionregistration_v1beta1_service_reference.md) \* | | [optional]
**url** | **char \*** | &#x60;url&#x60; gives the location of the webhook, in standard URL form (&#x60;scheme://host:port/path&#x60;). Exactly one of &#x60;url&#x60; or &#x60;service&#x60; must be specified. The &#x60;host&#x60; should not refer to a service running in the cluster; use the &#x60;service&#x60; field instead. The host might be resolved via external DNS in some apiservers (e.g., &#x60;kube-apiserver&#x60; cannot resolve in-cluster DNS as that would be a layering violation). &#x60;host&#x60; may also be an IP address. Please note that using &#x60;localhost&#x60; or &#x60;127.0.0.1&#x60; as a &#x60;host&#x60; is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. The scheme must be \&quot;https\&quot;; the URL must begin with \&quot;https://\&quot;. A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. Attempting to use a user or basic auth e.g. \&quot;user:password@\&quot; is not allowed. Fragments (\&quot;#...\&quot;) and query parameters (\&quot;?...\&quot;) are not allowed, either. | [optional]

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ca_bundle** | **char** | caBundle is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**ca_bundle** | **char \*** | caBundle is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**service** | [**apiextensions_v1_service_reference_t**](apiextensions_v1_service_reference.md) \* | | [optional]
**url** | **char \*** | url gives the location of the webhook, in standard URL form (&#x60;scheme://host:port/path&#x60;). Exactly one of &#x60;url&#x60; or &#x60;service&#x60; must be specified. The &#x60;host&#x60; should not refer to a service running in the cluster; use the &#x60;service&#x60; field instead. The host might be resolved via external DNS in some apiservers (e.g., &#x60;kube-apiserver&#x60; cannot resolve in-cluster DNS as that would be a layering violation). &#x60;host&#x60; may also be an IP address. Please note that using &#x60;localhost&#x60; or &#x60;127.0.0.1&#x60; as a &#x60;host&#x60; is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. The scheme must be \&quot;https\&quot;; the URL must begin with \&quot;https://\&quot;. A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. Attempting to use a user or basic auth e.g. \&quot;user:password@\&quot; is not allowed. Fragments (\&quot;#...\&quot;) and query parameters (\&quot;?...\&quot;) are not allowed, either. | [optional]

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ca_bundle** | **char** | caBundle is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**ca_bundle** | **char \*** | caBundle is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**service** | [**apiextensions_v1beta1_service_reference_t**](apiextensions_v1beta1_service_reference.md) \* | | [optional]
**url** | **char \*** | url gives the location of the webhook, in standard URL form (&#x60;scheme://host:port/path&#x60;). Exactly one of &#x60;url&#x60; or &#x60;service&#x60; must be specified. The &#x60;host&#x60; should not refer to a service running in the cluster; use the &#x60;service&#x60; field instead. The host might be resolved via external DNS in some apiservers (e.g., &#x60;kube-apiserver&#x60; cannot resolve in-cluster DNS as that would be a layering violation). &#x60;host&#x60; may also be an IP address. Please note that using &#x60;localhost&#x60; or &#x60;127.0.0.1&#x60; as a &#x60;host&#x60; is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. The scheme must be \&quot;https\&quot;; the URL must begin with \&quot;https://\&quot;. A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. Attempting to use a user or basic auth e.g. \&quot;user:password@\&quot; is not allowed. Fragments (\&quot;#...\&quot;) and query parameters (\&quot;?...\&quot;) are not allowed, either. | [optional]

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ca_bundle** | **char** | CABundle is a PEM encoded CA bundle which will be used to validate an API server&#39;s serving certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**ca_bundle** | **char \*** | CABundle is a PEM encoded CA bundle which will be used to validate an API server&#39;s serving certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**group** | **char \*** | Group is the API group name this server hosts | [optional]
**group_priority_minimum** | **int** | GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMininum values such that the whole group gets a higher priority. The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) We&#39;d recommend something like: *.k8s.io (except extensions) at 18000 and PaaSes (OpenShift, Deis) are recommended to be in the 2000s |
**insecure_skip_tls_verify** | **int** | InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead. | [optional]

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ca_bundle** | **char** | &#x60;caBundle&#x60; is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**ca_bundle** | **char \*** | &#x60;caBundle&#x60; is a PEM encoded CA bundle which will be used to validate the webhook&#39;s server certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**service** | [**v1alpha1_service_reference_t**](v1alpha1_service_reference.md) \* | | [optional]
**url** | **char \*** | &#x60;url&#x60; gives the location of the webhook, in standard URL form (&#x60;scheme://host:port/path&#x60;). Exactly one of &#x60;url&#x60; or &#x60;service&#x60; must be specified. The &#x60;host&#x60; should not refer to a service running in the cluster; use the &#x60;service&#x60; field instead. The host might be resolved via external DNS in some apiservers (e.g., &#x60;kube-apiserver&#x60; cannot resolve in-cluster DNS as that would be a layering violation). &#x60;host&#x60; may also be an IP address. Please note that using &#x60;localhost&#x60; or &#x60;127.0.0.1&#x60; as a &#x60;host&#x60; is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster. The scheme must be \&quot;https\&quot;; the URL must begin with \&quot;https://\&quot;. A path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier. Attempting to use a user or basic auth e.g. \&quot;user:password@\&quot; is not allowed. Fragments (\&quot;#...\&quot;) and query parameters (\&quot;?...\&quot;) are not allowed, either. | [optional]

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ca_bundle** | **char** | CABundle is a PEM encoded CA bundle which will be used to validate an API server&#39;s serving certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**ca_bundle** | **char \*** | CABundle is a PEM encoded CA bundle which will be used to validate an API server&#39;s serving certificate. If unspecified, system trust roots on the apiserver are used. | [optional]
**group** | **char \*** | Group is the API group name this server hosts | [optional]
**group_priority_minimum** | **int** | GroupPriorityMininum is the priority this group should have at least. Higher priority means that the group is preferred by clients over lower priority ones. Note that other versions of this group might specify even higher GroupPriorityMininum values such that the whole group gets a higher priority. The primary sort is based on GroupPriorityMinimum, ordered highest number to lowest (20 before 10). The secondary sort is based on the alphabetical comparison of the name of the object. (v1.bar before v1.foo) We&#39;d recommend something like: *.k8s.io (except extensions) at 18000 and PaaSes (OpenShift, Deis) are recommended to be in the 2000s |
**insecure_skip_tls_verify** | **int** | InsecureSkipTLSVerify disables TLS certificate verification when communicating with this server. This is strongly discouraged. You should use the CABundle instead. | [optional]

View File

@@ -5,7 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**extra** | **list_t*** | Extra information about the requesting user. See user.Info interface for details. | [optional]
**groups** | **list_t \*** | Group information about the requesting user. See user.Info interface for details. | [optional]
**request** | **char** | Base64-encoded PKCS#10 CSR data |
**request** | **char \*** | Base64-encoded PKCS#10 CSR data |
**uid** | **char \*** | UID information about the requesting user. See user.Info interface for details. | [optional]
**usages** | **list_t \*** | allowedUsages specifies a set of usage contexts the key will be valid for. See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3 https://tools.ietf.org/html/rfc5280#section-4.2.1.12 | [optional]
**username** | **char \*** | Information about the requesting user. See user.Info interface for details. | [optional]

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**certificate** | **char** | If request was approved, the controller will place the issued certificate here. | [optional]
**certificate** | **char \*** | If request was approved, the controller will place the issued certificate here. | [optional]
**conditions** | [**list_t**](v1beta1_certificate_signing_request_condition.md) \* | Conditions applied to the request, such as approval or denial. | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -6,7 +6,7 @@
admissionregistration_v1_webhook_client_config_t *admissionregistration_v1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
admissionregistration_v1_service_reference_t *service,
char *url
) {
@@ -43,8 +43,8 @@ cJSON *admissionregistration_v1_webhook_client_config_convertToJSON(admissionreg
// admissionregistration_v1_webhook_client_config->ca_bundle
if(admissionregistration_v1_webhook_client_config->ca_bundle) {
if(cJSON_AddNumberToObject(item, "caBundle", admissionregistration_v1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "caBundle", admissionregistration_v1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //ByteArray
}
}
@@ -84,9 +84,9 @@ admissionregistration_v1_webhook_client_config_t *admissionregistration_v1_webho
// admissionregistration_v1_webhook_client_config->ca_bundle
cJSON *ca_bundle = cJSON_GetObjectItemCaseSensitive(admissionregistration_v1_webhook_client_configJSON, "caBundle");
if (ca_bundle) {
if(!cJSON_IsNumber(ca_bundle))
if(!cJSON_IsString(ca_bundle))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -108,7 +108,7 @@ admissionregistration_v1_webhook_client_config_t *admissionregistration_v1_webho
admissionregistration_v1_webhook_client_config_local_var = admissionregistration_v1_webhook_client_config_create (
ca_bundle ? ca_bundle->valueint : 0,
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
service ? service_local_nonprim : NULL,
url ? strdup(url->valuestring) : NULL
);

View File

@@ -20,14 +20,14 @@ typedef struct admissionregistration_v1_webhook_client_config_t admissionregistr
typedef struct admissionregistration_v1_webhook_client_config_t {
char ca_bundle; //Byte
char *ca_bundle; //ByteArray
struct admissionregistration_v1_service_reference_t *service; //model
char *url; // string
} admissionregistration_v1_webhook_client_config_t;
admissionregistration_v1_webhook_client_config_t *admissionregistration_v1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
admissionregistration_v1_service_reference_t *service,
char *url
);

View File

@@ -6,7 +6,7 @@
admissionregistration_v1beta1_webhook_client_config_t *admissionregistration_v1beta1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
admissionregistration_v1beta1_service_reference_t *service,
char *url
) {
@@ -43,8 +43,8 @@ cJSON *admissionregistration_v1beta1_webhook_client_config_convertToJSON(admissi
// admissionregistration_v1beta1_webhook_client_config->ca_bundle
if(admissionregistration_v1beta1_webhook_client_config->ca_bundle) {
if(cJSON_AddNumberToObject(item, "caBundle", admissionregistration_v1beta1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "caBundle", admissionregistration_v1beta1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //ByteArray
}
}
@@ -84,9 +84,9 @@ admissionregistration_v1beta1_webhook_client_config_t *admissionregistration_v1b
// admissionregistration_v1beta1_webhook_client_config->ca_bundle
cJSON *ca_bundle = cJSON_GetObjectItemCaseSensitive(admissionregistration_v1beta1_webhook_client_configJSON, "caBundle");
if (ca_bundle) {
if(!cJSON_IsNumber(ca_bundle))
if(!cJSON_IsString(ca_bundle))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -108,7 +108,7 @@ admissionregistration_v1beta1_webhook_client_config_t *admissionregistration_v1b
admissionregistration_v1beta1_webhook_client_config_local_var = admissionregistration_v1beta1_webhook_client_config_create (
ca_bundle ? ca_bundle->valueint : 0,
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
service ? service_local_nonprim : NULL,
url ? strdup(url->valuestring) : NULL
);

View File

@@ -20,14 +20,14 @@ typedef struct admissionregistration_v1beta1_webhook_client_config_t admissionre
typedef struct admissionregistration_v1beta1_webhook_client_config_t {
char ca_bundle; //Byte
char *ca_bundle; //ByteArray
struct admissionregistration_v1beta1_service_reference_t *service; //model
char *url; // string
} admissionregistration_v1beta1_webhook_client_config_t;
admissionregistration_v1beta1_webhook_client_config_t *admissionregistration_v1beta1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
admissionregistration_v1beta1_service_reference_t *service,
char *url
);

View File

@@ -6,7 +6,7 @@
apiextensions_v1_webhook_client_config_t *apiextensions_v1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
apiextensions_v1_service_reference_t *service,
char *url
) {
@@ -43,8 +43,8 @@ cJSON *apiextensions_v1_webhook_client_config_convertToJSON(apiextensions_v1_web
// apiextensions_v1_webhook_client_config->ca_bundle
if(apiextensions_v1_webhook_client_config->ca_bundle) {
if(cJSON_AddNumberToObject(item, "caBundle", apiextensions_v1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "caBundle", apiextensions_v1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //ByteArray
}
}
@@ -84,9 +84,9 @@ apiextensions_v1_webhook_client_config_t *apiextensions_v1_webhook_client_config
// apiextensions_v1_webhook_client_config->ca_bundle
cJSON *ca_bundle = cJSON_GetObjectItemCaseSensitive(apiextensions_v1_webhook_client_configJSON, "caBundle");
if (ca_bundle) {
if(!cJSON_IsNumber(ca_bundle))
if(!cJSON_IsString(ca_bundle))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -108,7 +108,7 @@ apiextensions_v1_webhook_client_config_t *apiextensions_v1_webhook_client_config
apiextensions_v1_webhook_client_config_local_var = apiextensions_v1_webhook_client_config_create (
ca_bundle ? ca_bundle->valueint : 0,
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
service ? service_local_nonprim : NULL,
url ? strdup(url->valuestring) : NULL
);

View File

@@ -20,14 +20,14 @@ typedef struct apiextensions_v1_webhook_client_config_t apiextensions_v1_webhook
typedef struct apiextensions_v1_webhook_client_config_t {
char ca_bundle; //Byte
char *ca_bundle; //ByteArray
struct apiextensions_v1_service_reference_t *service; //model
char *url; // string
} apiextensions_v1_webhook_client_config_t;
apiextensions_v1_webhook_client_config_t *apiextensions_v1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
apiextensions_v1_service_reference_t *service,
char *url
);

View File

@@ -6,7 +6,7 @@
apiextensions_v1beta1_webhook_client_config_t *apiextensions_v1beta1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
apiextensions_v1beta1_service_reference_t *service,
char *url
) {
@@ -43,8 +43,8 @@ cJSON *apiextensions_v1beta1_webhook_client_config_convertToJSON(apiextensions_v
// apiextensions_v1beta1_webhook_client_config->ca_bundle
if(apiextensions_v1beta1_webhook_client_config->ca_bundle) {
if(cJSON_AddNumberToObject(item, "caBundle", apiextensions_v1beta1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "caBundle", apiextensions_v1beta1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //ByteArray
}
}
@@ -84,9 +84,9 @@ apiextensions_v1beta1_webhook_client_config_t *apiextensions_v1beta1_webhook_cli
// apiextensions_v1beta1_webhook_client_config->ca_bundle
cJSON *ca_bundle = cJSON_GetObjectItemCaseSensitive(apiextensions_v1beta1_webhook_client_configJSON, "caBundle");
if (ca_bundle) {
if(!cJSON_IsNumber(ca_bundle))
if(!cJSON_IsString(ca_bundle))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -108,7 +108,7 @@ apiextensions_v1beta1_webhook_client_config_t *apiextensions_v1beta1_webhook_cli
apiextensions_v1beta1_webhook_client_config_local_var = apiextensions_v1beta1_webhook_client_config_create (
ca_bundle ? ca_bundle->valueint : 0,
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
service ? service_local_nonprim : NULL,
url ? strdup(url->valuestring) : NULL
);

View File

@@ -20,14 +20,14 @@ typedef struct apiextensions_v1beta1_webhook_client_config_t apiextensions_v1bet
typedef struct apiextensions_v1beta1_webhook_client_config_t {
char ca_bundle; //Byte
char *ca_bundle; //ByteArray
struct apiextensions_v1beta1_service_reference_t *service; //model
char *url; // string
} apiextensions_v1beta1_webhook_client_config_t;
apiextensions_v1beta1_webhook_client_config_t *apiextensions_v1beta1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
apiextensions_v1beta1_service_reference_t *service,
char *url
);

View File

@@ -6,7 +6,7 @@
v1_api_service_spec_t *v1_api_service_spec_create(
char ca_bundle,
char *ca_bundle,
char *group,
int group_priority_minimum,
int insecure_skip_tls_verify,
@@ -55,8 +55,8 @@ cJSON *v1_api_service_spec_convertToJSON(v1_api_service_spec_t *v1_api_service_s
// v1_api_service_spec->ca_bundle
if(v1_api_service_spec->ca_bundle) {
if(cJSON_AddNumberToObject(item, "caBundle", v1_api_service_spec->ca_bundle) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "caBundle", v1_api_service_spec->ca_bundle) == NULL) {
goto fail; //ByteArray
}
}
@@ -134,9 +134,9 @@ v1_api_service_spec_t *v1_api_service_spec_parseFromJSON(cJSON *v1_api_service_s
// v1_api_service_spec->ca_bundle
cJSON *ca_bundle = cJSON_GetObjectItemCaseSensitive(v1_api_service_specJSON, "caBundle");
if (ca_bundle) {
if(!cJSON_IsNumber(ca_bundle))
if(!cJSON_IsString(ca_bundle))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -203,7 +203,7 @@ v1_api_service_spec_t *v1_api_service_spec_parseFromJSON(cJSON *v1_api_service_s
v1_api_service_spec_local_var = v1_api_service_spec_create (
ca_bundle ? ca_bundle->valueint : 0,
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
group ? strdup(group->valuestring) : NULL,
group_priority_minimum->valuedouble,
insecure_skip_tls_verify ? insecure_skip_tls_verify->valueint : 0,

View File

@@ -20,7 +20,7 @@ typedef struct v1_api_service_spec_t v1_api_service_spec_t;
typedef struct v1_api_service_spec_t {
char ca_bundle; //Byte
char *ca_bundle; //ByteArray
char *group; // string
int group_priority_minimum; //numeric
int insecure_skip_tls_verify; //boolean
@@ -31,7 +31,7 @@ typedef struct v1_api_service_spec_t {
} v1_api_service_spec_t;
v1_api_service_spec_t *v1_api_service_spec_create(
char ca_bundle,
char *ca_bundle,
char *group,
int group_priority_minimum,
int insecure_skip_tls_verify,

View File

@@ -88,6 +88,10 @@ cJSON *v1_config_map_convertToJSON(v1_config_map_t *v1_config_map) {
if (v1_config_map->binary_data) {
list_ForEach(binary_dataListEntry, v1_config_map->binary_data) {
keyValuePair_t *localKeyValue = (keyValuePair_t*)binary_dataListEntry->data;
if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL)
{
goto fail;
}
}
}
}
@@ -167,6 +171,11 @@ v1_config_map_t *v1_config_map_parseFromJSON(cJSON *v1_config_mapJSON){
cJSON_ArrayForEach(binary_data_local_map, binary_data)
{
cJSON *localMapObject = binary_data_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(binary_dataList , localMapKeyPair);
}
}

View File

@@ -94,6 +94,10 @@ cJSON *v1_secret_convertToJSON(v1_secret_t *v1_secret) {
if (v1_secret->data) {
list_ForEach(dataListEntry, v1_secret->data) {
keyValuePair_t *localKeyValue = (keyValuePair_t*)dataListEntry->data;
if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL)
{
goto fail;
}
}
}
}
@@ -181,6 +185,11 @@ v1_secret_t *v1_secret_parseFromJSON(cJSON *v1_secretJSON){
cJSON_ArrayForEach(data_local_map, data)
{
cJSON *localMapObject = data_local_map;
if(!cJSON_IsString(localMapObject))
{
goto end;
}
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
list_addElement(dataList , localMapKeyPair);
}
}

View File

@@ -6,7 +6,7 @@
v1alpha1_webhook_client_config_t *v1alpha1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
v1alpha1_service_reference_t *service,
char *url
) {
@@ -43,8 +43,8 @@ cJSON *v1alpha1_webhook_client_config_convertToJSON(v1alpha1_webhook_client_conf
// v1alpha1_webhook_client_config->ca_bundle
if(v1alpha1_webhook_client_config->ca_bundle) {
if(cJSON_AddNumberToObject(item, "caBundle", v1alpha1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "caBundle", v1alpha1_webhook_client_config->ca_bundle) == NULL) {
goto fail; //ByteArray
}
}
@@ -84,9 +84,9 @@ v1alpha1_webhook_client_config_t *v1alpha1_webhook_client_config_parseFromJSON(c
// v1alpha1_webhook_client_config->ca_bundle
cJSON *ca_bundle = cJSON_GetObjectItemCaseSensitive(v1alpha1_webhook_client_configJSON, "caBundle");
if (ca_bundle) {
if(!cJSON_IsNumber(ca_bundle))
if(!cJSON_IsString(ca_bundle))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -108,7 +108,7 @@ v1alpha1_webhook_client_config_t *v1alpha1_webhook_client_config_parseFromJSON(c
v1alpha1_webhook_client_config_local_var = v1alpha1_webhook_client_config_create (
ca_bundle ? ca_bundle->valueint : 0,
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
service ? service_local_nonprim : NULL,
url ? strdup(url->valuestring) : NULL
);

View File

@@ -20,14 +20,14 @@ typedef struct v1alpha1_webhook_client_config_t v1alpha1_webhook_client_config_t
typedef struct v1alpha1_webhook_client_config_t {
char ca_bundle; //Byte
char *ca_bundle; //ByteArray
struct v1alpha1_service_reference_t *service; //model
char *url; // string
} v1alpha1_webhook_client_config_t;
v1alpha1_webhook_client_config_t *v1alpha1_webhook_client_config_create(
char ca_bundle,
char *ca_bundle,
v1alpha1_service_reference_t *service,
char *url
);

View File

@@ -6,7 +6,7 @@
v1beta1_api_service_spec_t *v1beta1_api_service_spec_create(
char ca_bundle,
char *ca_bundle,
char *group,
int group_priority_minimum,
int insecure_skip_tls_verify,
@@ -55,8 +55,8 @@ cJSON *v1beta1_api_service_spec_convertToJSON(v1beta1_api_service_spec_t *v1beta
// v1beta1_api_service_spec->ca_bundle
if(v1beta1_api_service_spec->ca_bundle) {
if(cJSON_AddNumberToObject(item, "caBundle", v1beta1_api_service_spec->ca_bundle) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "caBundle", v1beta1_api_service_spec->ca_bundle) == NULL) {
goto fail; //ByteArray
}
}
@@ -134,9 +134,9 @@ v1beta1_api_service_spec_t *v1beta1_api_service_spec_parseFromJSON(cJSON *v1beta
// v1beta1_api_service_spec->ca_bundle
cJSON *ca_bundle = cJSON_GetObjectItemCaseSensitive(v1beta1_api_service_specJSON, "caBundle");
if (ca_bundle) {
if(!cJSON_IsNumber(ca_bundle))
if(!cJSON_IsString(ca_bundle))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -203,7 +203,7 @@ v1beta1_api_service_spec_t *v1beta1_api_service_spec_parseFromJSON(cJSON *v1beta
v1beta1_api_service_spec_local_var = v1beta1_api_service_spec_create (
ca_bundle ? ca_bundle->valueint : 0,
ca_bundle ? strdup(ca_bundle->valuestring) : NULL,
group ? strdup(group->valuestring) : NULL,
group_priority_minimum->valuedouble,
insecure_skip_tls_verify ? insecure_skip_tls_verify->valueint : 0,

View File

@@ -20,7 +20,7 @@ typedef struct v1beta1_api_service_spec_t v1beta1_api_service_spec_t;
typedef struct v1beta1_api_service_spec_t {
char ca_bundle; //Byte
char *ca_bundle; //ByteArray
char *group; // string
int group_priority_minimum; //numeric
int insecure_skip_tls_verify; //boolean
@@ -31,7 +31,7 @@ typedef struct v1beta1_api_service_spec_t {
} v1beta1_api_service_spec_t;
v1beta1_api_service_spec_t *v1beta1_api_service_spec_create(
char ca_bundle,
char *ca_bundle,
char *group,
int group_priority_minimum,
int insecure_skip_tls_verify,

View File

@@ -8,7 +8,7 @@
v1beta1_certificate_signing_request_spec_t *v1beta1_certificate_signing_request_spec_create(
list_t* extra,
list_t *groups,
char request,
char *request,
char *uid,
list_t *usages,
char *username
@@ -109,8 +109,8 @@ cJSON *v1beta1_certificate_signing_request_spec_convertToJSON(v1beta1_certificat
goto fail;
}
if(cJSON_AddNumberToObject(item, "request", v1beta1_certificate_signing_request_spec->request) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "request", v1beta1_certificate_signing_request_spec->request) == NULL) {
goto fail; //ByteArray
}
@@ -202,9 +202,9 @@ v1beta1_certificate_signing_request_spec_t *v1beta1_certificate_signing_request_
}
if(!cJSON_IsNumber(request))
if(!cJSON_IsString(request))
{
goto end; //Byte
goto end; //ByteArray
}
// v1beta1_certificate_signing_request_spec->uid
@@ -249,7 +249,7 @@ v1beta1_certificate_signing_request_spec_t *v1beta1_certificate_signing_request_
v1beta1_certificate_signing_request_spec_local_var = v1beta1_certificate_signing_request_spec_create (
extra ? extraList : NULL,
groups ? groupsList : NULL,
request->valueint,
strdup(request->valuestring),
uid ? strdup(uid->valuestring) : NULL,
usages ? usagesList : NULL,
username ? strdup(username->valuestring) : NULL

View File

@@ -21,7 +21,7 @@ typedef struct v1beta1_certificate_signing_request_spec_t v1beta1_certificate_si
typedef struct v1beta1_certificate_signing_request_spec_t {
list_t* extra; //map
list_t *groups; //primitive container
char request; //Byte
char *request; //ByteArray
char *uid; // string
list_t *usages; //primitive container
char *username; // string
@@ -31,7 +31,7 @@ typedef struct v1beta1_certificate_signing_request_spec_t {
v1beta1_certificate_signing_request_spec_t *v1beta1_certificate_signing_request_spec_create(
list_t* extra,
list_t *groups,
char request,
char *request,
char *uid,
list_t *usages,
char *username

View File

@@ -6,7 +6,7 @@
v1beta1_certificate_signing_request_status_t *v1beta1_certificate_signing_request_status_create(
char certificate,
char *certificate,
list_t *conditions
) {
v1beta1_certificate_signing_request_status_t *v1beta1_certificate_signing_request_status_local_var = malloc(sizeof(v1beta1_certificate_signing_request_status_t));
@@ -40,8 +40,8 @@ cJSON *v1beta1_certificate_signing_request_status_convertToJSON(v1beta1_certific
// v1beta1_certificate_signing_request_status->certificate
if(v1beta1_certificate_signing_request_status->certificate) {
if(cJSON_AddNumberToObject(item, "certificate", v1beta1_certificate_signing_request_status->certificate) == NULL) {
goto fail; //Byte
if(cJSON_AddStringToObject(item, "certificate", v1beta1_certificate_signing_request_status->certificate) == NULL) {
goto fail; //ByteArray
}
}
@@ -80,9 +80,9 @@ v1beta1_certificate_signing_request_status_t *v1beta1_certificate_signing_reques
// v1beta1_certificate_signing_request_status->certificate
cJSON *certificate = cJSON_GetObjectItemCaseSensitive(v1beta1_certificate_signing_request_statusJSON, "certificate");
if (certificate) {
if(!cJSON_IsNumber(certificate))
if(!cJSON_IsString(certificate))
{
goto end; //Byte
goto end; //ByteArray
}
}
@@ -110,7 +110,7 @@ v1beta1_certificate_signing_request_status_t *v1beta1_certificate_signing_reques
v1beta1_certificate_signing_request_status_local_var = v1beta1_certificate_signing_request_status_create (
certificate ? certificate->valueint : 0,
certificate ? strdup(certificate->valuestring) : NULL,
conditions ? conditionsList : NULL
);

View File

@@ -20,13 +20,13 @@ typedef struct v1beta1_certificate_signing_request_status_t v1beta1_certificate_
typedef struct v1beta1_certificate_signing_request_status_t {
char certificate; //Byte
char *certificate; //ByteArray
list_t *conditions; //nonprimitive container
} v1beta1_certificate_signing_request_status_t;
v1beta1_certificate_signing_request_status_t *v1beta1_certificate_signing_request_status_create(
char certificate,
char *certificate,
list_t *conditions
);