Files
c/kubernetes/model/v1alpha1_service_account_subject.c
Hui Yu 732348e69e Re-generate the C client to merge recent changes from openapi-generator:
1. [C][Client] Add C++ reserved keywords to C-libcurl client generator,then the C client can be compiled by C++ compiler (#8205)

2. [C][Client] Disable escaping the parameter name in URL path string (#8243)

3. [C][Client] Fix coredump when releasing the memory of an incompleted model (#8190)
2021-01-05 15:42:34 +08:00

108 lines
3.0 KiB
C

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "v1alpha1_service_account_subject.h"
v1alpha1_service_account_subject_t *v1alpha1_service_account_subject_create(
char *name,
char *_namespace
) {
v1alpha1_service_account_subject_t *v1alpha1_service_account_subject_local_var = malloc(sizeof(v1alpha1_service_account_subject_t));
if (!v1alpha1_service_account_subject_local_var) {
return NULL;
}
v1alpha1_service_account_subject_local_var->name = name;
v1alpha1_service_account_subject_local_var->_namespace = _namespace;
return v1alpha1_service_account_subject_local_var;
}
void v1alpha1_service_account_subject_free(v1alpha1_service_account_subject_t *v1alpha1_service_account_subject) {
if(NULL == v1alpha1_service_account_subject){
return ;
}
listEntry_t *listEntry;
if (v1alpha1_service_account_subject->name) {
free(v1alpha1_service_account_subject->name);
v1alpha1_service_account_subject->name = NULL;
}
if (v1alpha1_service_account_subject->_namespace) {
free(v1alpha1_service_account_subject->_namespace);
v1alpha1_service_account_subject->_namespace = NULL;
}
free(v1alpha1_service_account_subject);
}
cJSON *v1alpha1_service_account_subject_convertToJSON(v1alpha1_service_account_subject_t *v1alpha1_service_account_subject) {
cJSON *item = cJSON_CreateObject();
// v1alpha1_service_account_subject->name
if (!v1alpha1_service_account_subject->name) {
goto fail;
}
if(cJSON_AddStringToObject(item, "name", v1alpha1_service_account_subject->name) == NULL) {
goto fail; //String
}
// v1alpha1_service_account_subject->_namespace
if (!v1alpha1_service_account_subject->_namespace) {
goto fail;
}
if(cJSON_AddStringToObject(item, "namespace", v1alpha1_service_account_subject->_namespace) == NULL) {
goto fail; //String
}
return item;
fail:
if (item) {
cJSON_Delete(item);
}
return NULL;
}
v1alpha1_service_account_subject_t *v1alpha1_service_account_subject_parseFromJSON(cJSON *v1alpha1_service_account_subjectJSON){
v1alpha1_service_account_subject_t *v1alpha1_service_account_subject_local_var = NULL;
// v1alpha1_service_account_subject->name
cJSON *name = cJSON_GetObjectItemCaseSensitive(v1alpha1_service_account_subjectJSON, "name");
if (!name) {
goto end;
}
if(!cJSON_IsString(name))
{
goto end; //String
}
// v1alpha1_service_account_subject->_namespace
cJSON *_namespace = cJSON_GetObjectItemCaseSensitive(v1alpha1_service_account_subjectJSON, "namespace");
if (!_namespace) {
goto end;
}
if(!cJSON_IsString(_namespace))
{
goto end; //String
}
v1alpha1_service_account_subject_local_var = v1alpha1_service_account_subject_create (
strdup(name->valuestring),
strdup(_namespace->valuestring)
);
return v1alpha1_service_account_subject_local_var;
end:
return NULL;
}