Support the type "IntOrString" (Automatically generated part)

This commit is contained in:
Hui Yu
2021-12-20 17:14:46 +08:00
parent 5eafd277d8
commit 67a504f84d
33 changed files with 15844 additions and 15779 deletions

View File

@@ -6,7 +6,7 @@ Name | Type | Description | Notes
**host** | **char \*** | Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead. | [optional] **host** | **char \*** | Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead. | [optional]
**http_headers** | [**list_t**](v1_http_header.md) \* | Custom headers to set in the request. HTTP allows repeated headers. | [optional] **http_headers** | [**list_t**](v1_http_header.md) \* | Custom headers to set in the request. HTTP allows repeated headers. | [optional]
**path** | **char \*** | Path to access on the HTTP server. | [optional] **path** | **char \*** | Path to access on the HTTP server. | [optional]
**port** | [**object_t**](.md) \* | Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. | **port** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. |
**scheme** | **char \*** | Scheme to use for connecting to the host. Defaults to HTTP. | [optional] **scheme** | **char \*** | Scheme to use for connecting to the host. Defaults to HTTP. | [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) [[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

@@ -4,7 +4,7 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**end_port** | **int** | If set, indicates that the range of ports from port to endPort, inclusive, should be allowed by the policy. This field cannot be defined if the port field is not defined or if the port field is defined as a named (string) port. The endPort must be equal or greater than port. This feature is in Beta state and is enabled by default. It can be disabled using the Feature Gate \"NetworkPolicyEndPort\". | [optional] **end_port** | **int** | If set, indicates that the range of ports from port to endPort, inclusive, should be allowed by the policy. This field cannot be defined if the port field is not defined or if the port field is defined as a named (string) port. The endPort must be equal or greater than port. This feature is in Beta state and is enabled by default. It can be disabled using the Feature Gate \"NetworkPolicyEndPort\". | [optional]
**port** | [**object_t**](.md) \* | The port on the given protocol. This can either be a numerical or named port on a pod. If this field is not provided, this matches all port names and numbers. If present, only traffic on the specified protocol AND port will be matched. | [optional] **port** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [optional]
**protocol** | **char \*** | The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. | [optional] **protocol** | **char \*** | The protocol (TCP, UDP, or SCTP) which traffic must match. If not specified, this field defaults to TCP. | [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) [[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

@@ -3,8 +3,8 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**max_unavailable** | [**object_t**](.md) \* | An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\". | [optional] **max_unavailable** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [optional]
**min_available** | [**object_t**](.md) \* | An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\". | [optional] **min_available** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [optional]
**selector** | [**v1_label_selector_t**](v1_label_selector.md) \* | | [optional] **selector** | [**v1_label_selector_t**](v1_label_selector.md) \* | | [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) [[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

@@ -3,8 +3,8 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**max_surge** | [**object_t**](.md) \* | The maximum number of nodes with an existing available DaemonSet pod that can have an updated DaemonSet pod during during an update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up to a minimum of 1. Default value is 0. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their a new pod created before the old pod is marked as deleted. The update starts by launching new pods on 30% of nodes. Once an updated pod is available (Ready for at least minReadySeconds) the old DaemonSet pod on that node is marked deleted. If the old pod becomes unavailable for any reason (Ready transitions to false, is evicted, or is drained) an updated pod is immediatedly created on that node without considering surge limits. Allowing surge implies the possibility that the resources consumed by the daemonset on any given node can double if the readiness check fails, and so resource intensive daemonsets should take into account that they may cause evictions during disruption. This is beta field and enabled/disabled by DaemonSetUpdateSurge feature gate. | [optional] **max_surge** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [optional]
**max_unavailable** | [**object_t**](.md) \* | The maximum number of DaemonSet pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of total number of DaemonSet pods at the start of the update (ex: 10%). Absolute number is calculated from percentage by rounding up. This cannot be 0 if MaxSurge is 0 Default value is 1. Example: when this is set to 30%, at most 30% of the total number of nodes that should be running the daemon pod (i.e. status.desiredNumberScheduled) can have their pods stopped for an update at any given time. The update starts by stopping at most 30% of those DaemonSet pods and then brings up new DaemonSet pods in their place. Once the new pods are available, it then proceeds onto other DaemonSet pods, thus ensuring that at least 70% of original number of DaemonSet pods are available at all times during the update. | [optional] **max_unavailable** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [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) [[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

@@ -3,8 +3,8 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**max_surge** | [**object_t**](.md) \* | The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods. | [optional] **max_surge** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [optional]
**max_unavailable** | [**object_t**](.md) \* | The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods. | [optional] **max_unavailable** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [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) [[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

@@ -8,7 +8,7 @@ Name | Type | Description | Notes
**node_port** | **int** | The port on each node on which this service is exposed when type is NodePort or LoadBalancer. Usually assigned by the system. If a value is specified, in-range, and not in use it will be used, otherwise the operation will fail. If not specified, a port will be allocated if this Service requires one. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport | [optional] **node_port** | **int** | The port on each node on which this service is exposed when type is NodePort or LoadBalancer. Usually assigned by the system. If a value is specified, in-range, and not in use it will be used, otherwise the operation will fail. If not specified, a port will be allocated if this Service requires one. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport | [optional]
**port** | **int** | The port that will be exposed by this service. | **port** | **int** | The port that will be exposed by this service. |
**protocol** | **char \*** | The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP. | [optional] **protocol** | **char \*** | The IP protocol for this port. Supports \"TCP\", \"UDP\", and \"SCTP\". Default is TCP. | [optional]
**target_port** | [**object_t**](.md) \* | Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service | [optional] **target_port** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [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) [[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

@@ -4,7 +4,7 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**host** | **char \*** | Optional: Host name to connect to, defaults to the pod IP. | [optional] **host** | **char \*** | Optional: Host name to connect to, defaults to the pod IP. | [optional]
**port** | [**object_t**](.md) \* | Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. | **port** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[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

@@ -3,8 +3,8 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**max_unavailable** | [**object_t**](.md) \* | An eviction is allowed if at most \"maxUnavailable\" pods selected by \"selector\" are unavailable after the eviction, i.e. even in absence of the evicted pod. For example, one can prevent all voluntary evictions by specifying 0. This is a mutually exclusive setting with \"minAvailable\". | [optional] **max_unavailable** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [optional]
**min_available** | [**object_t**](.md) \* | An eviction is allowed if at least \"minAvailable\" pods selected by \"selector\" will still be available after the eviction, i.e. even in the absence of the evicted pod. So for example you can prevent all voluntary evictions by specifying \"100%\". | [optional] **min_available** | **int_or_string_t \*** | IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number. | [optional]
**selector** | [**v1_label_selector_t**](v1_label_selector.md) \* | | [optional] **selector** | [**v1_label_selector_t**](v1_label_selector.md) \* | | [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) [[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

@@ -9,7 +9,7 @@ v1_http_get_action_t *v1_http_get_action_create(
char *host, char *host,
list_t *http_headers, list_t *http_headers,
char *path, char *path,
object_t *port, int_or_string_t *port,
char *scheme char *scheme
) { ) {
v1_http_get_action_t *v1_http_get_action_local_var = malloc(sizeof(v1_http_get_action_t)); v1_http_get_action_t *v1_http_get_action_local_var = malloc(sizeof(v1_http_get_action_t));
@@ -47,7 +47,7 @@ void v1_http_get_action_free(v1_http_get_action_t *v1_http_get_action) {
v1_http_get_action->path = NULL; v1_http_get_action->path = NULL;
} }
if (v1_http_get_action->port) { if (v1_http_get_action->port) {
object_free(v1_http_get_action->port); int_or_string_free(v1_http_get_action->port);
v1_http_get_action->port = NULL; v1_http_get_action->port = NULL;
} }
if (v1_http_get_action->scheme) { if (v1_http_get_action->scheme) {
@@ -101,13 +101,13 @@ cJSON *v1_http_get_action_convertToJSON(v1_http_get_action_t *v1_http_get_action
goto fail; goto fail;
} }
cJSON *port_object = object_convertToJSON(v1_http_get_action->port); cJSON *port_local_JSON = int_or_string_convertToJSON(v1_http_get_action->port);
if(port_object == NULL) { if(port_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "port", port_object); cJSON_AddItemToObject(item, "port", port_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
@@ -130,6 +130,9 @@ v1_http_get_action_t *v1_http_get_action_parseFromJSON(cJSON *v1_http_get_action
v1_http_get_action_t *v1_http_get_action_local_var = NULL; v1_http_get_action_t *v1_http_get_action_local_var = NULL;
// define the local variable for v1_http_get_action->port
int_or_string_t *port_local_nonprim = NULL;
// v1_http_get_action->host // v1_http_get_action->host
cJSON *host = cJSON_GetObjectItemCaseSensitive(v1_http_get_actionJSON, "host"); cJSON *host = cJSON_GetObjectItemCaseSensitive(v1_http_get_actionJSON, "host");
if (host) { if (host) {
@@ -176,9 +179,8 @@ v1_http_get_action_t *v1_http_get_action_parseFromJSON(cJSON *v1_http_get_action
goto end; goto end;
} }
object_t *port_local_object = NULL;
port_local_object = object_parseFromJSON(port); //object port_local_nonprim = int_or_string_parseFromJSON(port); //custom
// v1_http_get_action->scheme // v1_http_get_action->scheme
cJSON *scheme = cJSON_GetObjectItemCaseSensitive(v1_http_get_actionJSON, "scheme"); cJSON *scheme = cJSON_GetObjectItemCaseSensitive(v1_http_get_actionJSON, "scheme");
@@ -194,12 +196,16 @@ v1_http_get_action_t *v1_http_get_action_parseFromJSON(cJSON *v1_http_get_action
host ? strdup(host->valuestring) : NULL, host ? strdup(host->valuestring) : NULL,
http_headers ? http_headersList : NULL, http_headers ? http_headersList : NULL,
path ? strdup(path->valuestring) : NULL, path ? strdup(path->valuestring) : NULL,
port_local_object, port_local_nonprim,
scheme ? strdup(scheme->valuestring) : NULL scheme ? strdup(scheme->valuestring) : NULL
); );
return v1_http_get_action_local_var; return v1_http_get_action_local_var;
end: end:
if (port_local_nonprim) {
int_or_string_free(port_local_nonprim);
port_local_nonprim = NULL;
}
return NULL; return NULL;
} }

View File

@@ -15,7 +15,7 @@
typedef struct v1_http_get_action_t v1_http_get_action_t; typedef struct v1_http_get_action_t v1_http_get_action_t;
#include "object.h" #include "int_or_string.h"
#include "v1_http_header.h" #include "v1_http_header.h"
@@ -24,7 +24,7 @@ typedef struct v1_http_get_action_t {
char *host; // string char *host; // string
list_t *http_headers; //nonprimitive container list_t *http_headers; //nonprimitive container
char *path; // string char *path; // string
object_t *port; //object int_or_string_t *port; // custom
char *scheme; // string char *scheme; // string
} v1_http_get_action_t; } v1_http_get_action_t;
@@ -33,7 +33,7 @@ v1_http_get_action_t *v1_http_get_action_create(
char *host, char *host,
list_t *http_headers, list_t *http_headers,
char *path, char *path,
object_t *port, int_or_string_t *port,
char *scheme char *scheme
); );

View File

@@ -7,7 +7,7 @@
v1_network_policy_port_t *v1_network_policy_port_create( v1_network_policy_port_t *v1_network_policy_port_create(
int end_port, int end_port,
object_t *port, int_or_string_t *port,
char *protocol char *protocol
) { ) {
v1_network_policy_port_t *v1_network_policy_port_local_var = malloc(sizeof(v1_network_policy_port_t)); v1_network_policy_port_t *v1_network_policy_port_local_var = malloc(sizeof(v1_network_policy_port_t));
@@ -28,7 +28,7 @@ void v1_network_policy_port_free(v1_network_policy_port_t *v1_network_policy_por
} }
listEntry_t *listEntry; listEntry_t *listEntry;
if (v1_network_policy_port->port) { if (v1_network_policy_port->port) {
object_free(v1_network_policy_port->port); int_or_string_free(v1_network_policy_port->port);
v1_network_policy_port->port = NULL; v1_network_policy_port->port = NULL;
} }
if (v1_network_policy_port->protocol) { if (v1_network_policy_port->protocol) {
@@ -51,13 +51,13 @@ cJSON *v1_network_policy_port_convertToJSON(v1_network_policy_port_t *v1_network
// v1_network_policy_port->port // v1_network_policy_port->port
if(v1_network_policy_port->port) { if(v1_network_policy_port->port) {
cJSON *port_object = object_convertToJSON(v1_network_policy_port->port); cJSON *port_local_JSON = int_or_string_convertToJSON(v1_network_policy_port->port);
if(port_object == NULL) { if(port_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "port", port_object); cJSON_AddItemToObject(item, "port", port_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
@@ -81,6 +81,9 @@ v1_network_policy_port_t *v1_network_policy_port_parseFromJSON(cJSON *v1_network
v1_network_policy_port_t *v1_network_policy_port_local_var = NULL; v1_network_policy_port_t *v1_network_policy_port_local_var = NULL;
// define the local variable for v1_network_policy_port->port
int_or_string_t *port_local_nonprim = NULL;
// v1_network_policy_port->end_port // v1_network_policy_port->end_port
cJSON *end_port = cJSON_GetObjectItemCaseSensitive(v1_network_policy_portJSON, "endPort"); cJSON *end_port = cJSON_GetObjectItemCaseSensitive(v1_network_policy_portJSON, "endPort");
if (end_port) { if (end_port) {
@@ -92,9 +95,8 @@ v1_network_policy_port_t *v1_network_policy_port_parseFromJSON(cJSON *v1_network
// v1_network_policy_port->port // v1_network_policy_port->port
cJSON *port = cJSON_GetObjectItemCaseSensitive(v1_network_policy_portJSON, "port"); cJSON *port = cJSON_GetObjectItemCaseSensitive(v1_network_policy_portJSON, "port");
object_t *port_local_object = NULL;
if (port) { if (port) {
port_local_object = object_parseFromJSON(port); //object port_local_nonprim = int_or_string_parseFromJSON(port); //custom
} }
// v1_network_policy_port->protocol // v1_network_policy_port->protocol
@@ -109,12 +111,16 @@ v1_network_policy_port_t *v1_network_policy_port_parseFromJSON(cJSON *v1_network
v1_network_policy_port_local_var = v1_network_policy_port_create ( v1_network_policy_port_local_var = v1_network_policy_port_create (
end_port ? end_port->valuedouble : 0, end_port ? end_port->valuedouble : 0,
port ? port_local_object : NULL, port ? port_local_nonprim : NULL,
protocol ? strdup(protocol->valuestring) : NULL protocol ? strdup(protocol->valuestring) : NULL
); );
return v1_network_policy_port_local_var; return v1_network_policy_port_local_var;
end: end:
if (port_local_nonprim) {
int_or_string_free(port_local_nonprim);
port_local_nonprim = NULL;
}
return NULL; return NULL;
} }

View File

@@ -15,20 +15,20 @@
typedef struct v1_network_policy_port_t v1_network_policy_port_t; typedef struct v1_network_policy_port_t v1_network_policy_port_t;
#include "object.h" #include "int_or_string.h"
typedef struct v1_network_policy_port_t { typedef struct v1_network_policy_port_t {
int end_port; //numeric int end_port; //numeric
object_t *port; //object int_or_string_t *port; // custom
char *protocol; // string char *protocol; // string
} v1_network_policy_port_t; } v1_network_policy_port_t;
v1_network_policy_port_t *v1_network_policy_port_create( v1_network_policy_port_t *v1_network_policy_port_create(
int end_port, int end_port,
object_t *port, int_or_string_t *port,
char *protocol char *protocol
); );

View File

@@ -6,8 +6,8 @@
v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_create( v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_create(
object_t *max_unavailable, int_or_string_t *max_unavailable,
object_t *min_available, int_or_string_t *min_available,
v1_label_selector_t *selector v1_label_selector_t *selector
) { ) {
v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_local_var = malloc(sizeof(v1_pod_disruption_budget_spec_t)); v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_local_var = malloc(sizeof(v1_pod_disruption_budget_spec_t));
@@ -28,11 +28,11 @@ void v1_pod_disruption_budget_spec_free(v1_pod_disruption_budget_spec_t *v1_pod_
} }
listEntry_t *listEntry; listEntry_t *listEntry;
if (v1_pod_disruption_budget_spec->max_unavailable) { if (v1_pod_disruption_budget_spec->max_unavailable) {
object_free(v1_pod_disruption_budget_spec->max_unavailable); int_or_string_free(v1_pod_disruption_budget_spec->max_unavailable);
v1_pod_disruption_budget_spec->max_unavailable = NULL; v1_pod_disruption_budget_spec->max_unavailable = NULL;
} }
if (v1_pod_disruption_budget_spec->min_available) { if (v1_pod_disruption_budget_spec->min_available) {
object_free(v1_pod_disruption_budget_spec->min_available); int_or_string_free(v1_pod_disruption_budget_spec->min_available);
v1_pod_disruption_budget_spec->min_available = NULL; v1_pod_disruption_budget_spec->min_available = NULL;
} }
if (v1_pod_disruption_budget_spec->selector) { if (v1_pod_disruption_budget_spec->selector) {
@@ -47,26 +47,26 @@ cJSON *v1_pod_disruption_budget_spec_convertToJSON(v1_pod_disruption_budget_spec
// v1_pod_disruption_budget_spec->max_unavailable // v1_pod_disruption_budget_spec->max_unavailable
if(v1_pod_disruption_budget_spec->max_unavailable) { if(v1_pod_disruption_budget_spec->max_unavailable) {
cJSON *max_unavailable_object = object_convertToJSON(v1_pod_disruption_budget_spec->max_unavailable); cJSON *max_unavailable_local_JSON = int_or_string_convertToJSON(v1_pod_disruption_budget_spec->max_unavailable);
if(max_unavailable_object == NULL) { if(max_unavailable_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_object); cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
// v1_pod_disruption_budget_spec->min_available // v1_pod_disruption_budget_spec->min_available
if(v1_pod_disruption_budget_spec->min_available) { if(v1_pod_disruption_budget_spec->min_available) {
cJSON *min_available_object = object_convertToJSON(v1_pod_disruption_budget_spec->min_available); cJSON *min_available_local_JSON = int_or_string_convertToJSON(v1_pod_disruption_budget_spec->min_available);
if(min_available_object == NULL) { if(min_available_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "minAvailable", min_available_object); cJSON_AddItemToObject(item, "minAvailable", min_available_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
@@ -95,21 +95,25 @@ v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_parseFromJSON(cJS
v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_local_var = NULL; v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_local_var = NULL;
// define the local variable for v1_pod_disruption_budget_spec->max_unavailable
int_or_string_t *max_unavailable_local_nonprim = NULL;
// define the local variable for v1_pod_disruption_budget_spec->min_available
int_or_string_t *min_available_local_nonprim = NULL;
// define the local variable for v1_pod_disruption_budget_spec->selector // define the local variable for v1_pod_disruption_budget_spec->selector
v1_label_selector_t *selector_local_nonprim = NULL; v1_label_selector_t *selector_local_nonprim = NULL;
// v1_pod_disruption_budget_spec->max_unavailable // v1_pod_disruption_budget_spec->max_unavailable
cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1_pod_disruption_budget_specJSON, "maxUnavailable"); cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1_pod_disruption_budget_specJSON, "maxUnavailable");
object_t *max_unavailable_local_object = NULL;
if (max_unavailable) { if (max_unavailable) {
max_unavailable_local_object = object_parseFromJSON(max_unavailable); //object max_unavailable_local_nonprim = int_or_string_parseFromJSON(max_unavailable); //custom
} }
// v1_pod_disruption_budget_spec->min_available // v1_pod_disruption_budget_spec->min_available
cJSON *min_available = cJSON_GetObjectItemCaseSensitive(v1_pod_disruption_budget_specJSON, "minAvailable"); cJSON *min_available = cJSON_GetObjectItemCaseSensitive(v1_pod_disruption_budget_specJSON, "minAvailable");
object_t *min_available_local_object = NULL;
if (min_available) { if (min_available) {
min_available_local_object = object_parseFromJSON(min_available); //object min_available_local_nonprim = int_or_string_parseFromJSON(min_available); //custom
} }
// v1_pod_disruption_budget_spec->selector // v1_pod_disruption_budget_spec->selector
@@ -120,13 +124,21 @@ v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_parseFromJSON(cJS
v1_pod_disruption_budget_spec_local_var = v1_pod_disruption_budget_spec_create ( v1_pod_disruption_budget_spec_local_var = v1_pod_disruption_budget_spec_create (
max_unavailable ? max_unavailable_local_object : NULL, max_unavailable ? max_unavailable_local_nonprim : NULL,
min_available ? min_available_local_object : NULL, min_available ? min_available_local_nonprim : NULL,
selector ? selector_local_nonprim : NULL selector ? selector_local_nonprim : NULL
); );
return v1_pod_disruption_budget_spec_local_var; return v1_pod_disruption_budget_spec_local_var;
end: end:
if (max_unavailable_local_nonprim) {
int_or_string_free(max_unavailable_local_nonprim);
max_unavailable_local_nonprim = NULL;
}
if (min_available_local_nonprim) {
int_or_string_free(min_available_local_nonprim);
min_available_local_nonprim = NULL;
}
if (selector_local_nonprim) { if (selector_local_nonprim) {
v1_label_selector_free(selector_local_nonprim); v1_label_selector_free(selector_local_nonprim);
selector_local_nonprim = NULL; selector_local_nonprim = NULL;

View File

@@ -15,21 +15,21 @@
typedef struct v1_pod_disruption_budget_spec_t v1_pod_disruption_budget_spec_t; typedef struct v1_pod_disruption_budget_spec_t v1_pod_disruption_budget_spec_t;
#include "object.h" #include "int_or_string.h"
#include "v1_label_selector.h" #include "v1_label_selector.h"
typedef struct v1_pod_disruption_budget_spec_t { typedef struct v1_pod_disruption_budget_spec_t {
object_t *max_unavailable; //object int_or_string_t *max_unavailable; // custom
object_t *min_available; //object int_or_string_t *min_available; // custom
struct v1_label_selector_t *selector; //model struct v1_label_selector_t *selector; //model
} v1_pod_disruption_budget_spec_t; } v1_pod_disruption_budget_spec_t;
v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_create( v1_pod_disruption_budget_spec_t *v1_pod_disruption_budget_spec_create(
object_t *max_unavailable, int_or_string_t *max_unavailable,
object_t *min_available, int_or_string_t *min_available,
v1_label_selector_t *selector v1_label_selector_t *selector
); );

View File

@@ -6,8 +6,8 @@
v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_create( v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_create(
object_t *max_surge, int_or_string_t *max_surge,
object_t *max_unavailable int_or_string_t *max_unavailable
) { ) {
v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_local_var = malloc(sizeof(v1_rolling_update_daemon_set_t)); v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_local_var = malloc(sizeof(v1_rolling_update_daemon_set_t));
if (!v1_rolling_update_daemon_set_local_var) { if (!v1_rolling_update_daemon_set_local_var) {
@@ -26,11 +26,11 @@ void v1_rolling_update_daemon_set_free(v1_rolling_update_daemon_set_t *v1_rollin
} }
listEntry_t *listEntry; listEntry_t *listEntry;
if (v1_rolling_update_daemon_set->max_surge) { if (v1_rolling_update_daemon_set->max_surge) {
object_free(v1_rolling_update_daemon_set->max_surge); int_or_string_free(v1_rolling_update_daemon_set->max_surge);
v1_rolling_update_daemon_set->max_surge = NULL; v1_rolling_update_daemon_set->max_surge = NULL;
} }
if (v1_rolling_update_daemon_set->max_unavailable) { if (v1_rolling_update_daemon_set->max_unavailable) {
object_free(v1_rolling_update_daemon_set->max_unavailable); int_or_string_free(v1_rolling_update_daemon_set->max_unavailable);
v1_rolling_update_daemon_set->max_unavailable = NULL; v1_rolling_update_daemon_set->max_unavailable = NULL;
} }
free(v1_rolling_update_daemon_set); free(v1_rolling_update_daemon_set);
@@ -41,26 +41,26 @@ cJSON *v1_rolling_update_daemon_set_convertToJSON(v1_rolling_update_daemon_set_t
// v1_rolling_update_daemon_set->max_surge // v1_rolling_update_daemon_set->max_surge
if(v1_rolling_update_daemon_set->max_surge) { if(v1_rolling_update_daemon_set->max_surge) {
cJSON *max_surge_object = object_convertToJSON(v1_rolling_update_daemon_set->max_surge); cJSON *max_surge_local_JSON = int_or_string_convertToJSON(v1_rolling_update_daemon_set->max_surge);
if(max_surge_object == NULL) { if(max_surge_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "maxSurge", max_surge_object); cJSON_AddItemToObject(item, "maxSurge", max_surge_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
// v1_rolling_update_daemon_set->max_unavailable // v1_rolling_update_daemon_set->max_unavailable
if(v1_rolling_update_daemon_set->max_unavailable) { if(v1_rolling_update_daemon_set->max_unavailable) {
cJSON *max_unavailable_object = object_convertToJSON(v1_rolling_update_daemon_set->max_unavailable); cJSON *max_unavailable_local_JSON = int_or_string_convertToJSON(v1_rolling_update_daemon_set->max_unavailable);
if(max_unavailable_object == NULL) { if(max_unavailable_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_object); cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
@@ -76,28 +76,40 @@ v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_parseFromJSON(cJSON
v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_local_var = NULL; v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_local_var = NULL;
// define the local variable for v1_rolling_update_daemon_set->max_surge
int_or_string_t *max_surge_local_nonprim = NULL;
// define the local variable for v1_rolling_update_daemon_set->max_unavailable
int_or_string_t *max_unavailable_local_nonprim = NULL;
// v1_rolling_update_daemon_set->max_surge // v1_rolling_update_daemon_set->max_surge
cJSON *max_surge = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_daemon_setJSON, "maxSurge"); cJSON *max_surge = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_daemon_setJSON, "maxSurge");
object_t *max_surge_local_object = NULL;
if (max_surge) { if (max_surge) {
max_surge_local_object = object_parseFromJSON(max_surge); //object max_surge_local_nonprim = int_or_string_parseFromJSON(max_surge); //custom
} }
// v1_rolling_update_daemon_set->max_unavailable // v1_rolling_update_daemon_set->max_unavailable
cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_daemon_setJSON, "maxUnavailable"); cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_daemon_setJSON, "maxUnavailable");
object_t *max_unavailable_local_object = NULL;
if (max_unavailable) { if (max_unavailable) {
max_unavailable_local_object = object_parseFromJSON(max_unavailable); //object max_unavailable_local_nonprim = int_or_string_parseFromJSON(max_unavailable); //custom
} }
v1_rolling_update_daemon_set_local_var = v1_rolling_update_daemon_set_create ( v1_rolling_update_daemon_set_local_var = v1_rolling_update_daemon_set_create (
max_surge ? max_surge_local_object : NULL, max_surge ? max_surge_local_nonprim : NULL,
max_unavailable ? max_unavailable_local_object : NULL max_unavailable ? max_unavailable_local_nonprim : NULL
); );
return v1_rolling_update_daemon_set_local_var; return v1_rolling_update_daemon_set_local_var;
end: end:
if (max_surge_local_nonprim) {
int_or_string_free(max_surge_local_nonprim);
max_surge_local_nonprim = NULL;
}
if (max_unavailable_local_nonprim) {
int_or_string_free(max_unavailable_local_nonprim);
max_unavailable_local_nonprim = NULL;
}
return NULL; return NULL;
} }

View File

@@ -15,19 +15,19 @@
typedef struct v1_rolling_update_daemon_set_t v1_rolling_update_daemon_set_t; typedef struct v1_rolling_update_daemon_set_t v1_rolling_update_daemon_set_t;
#include "object.h" #include "int_or_string.h"
typedef struct v1_rolling_update_daemon_set_t { typedef struct v1_rolling_update_daemon_set_t {
object_t *max_surge; //object int_or_string_t *max_surge; // custom
object_t *max_unavailable; //object int_or_string_t *max_unavailable; // custom
} v1_rolling_update_daemon_set_t; } v1_rolling_update_daemon_set_t;
v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_create( v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set_create(
object_t *max_surge, int_or_string_t *max_surge,
object_t *max_unavailable int_or_string_t *max_unavailable
); );
void v1_rolling_update_daemon_set_free(v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set); void v1_rolling_update_daemon_set_free(v1_rolling_update_daemon_set_t *v1_rolling_update_daemon_set);

View File

@@ -6,8 +6,8 @@
v1_rolling_update_deployment_t *v1_rolling_update_deployment_create( v1_rolling_update_deployment_t *v1_rolling_update_deployment_create(
object_t *max_surge, int_or_string_t *max_surge,
object_t *max_unavailable int_or_string_t *max_unavailable
) { ) {
v1_rolling_update_deployment_t *v1_rolling_update_deployment_local_var = malloc(sizeof(v1_rolling_update_deployment_t)); v1_rolling_update_deployment_t *v1_rolling_update_deployment_local_var = malloc(sizeof(v1_rolling_update_deployment_t));
if (!v1_rolling_update_deployment_local_var) { if (!v1_rolling_update_deployment_local_var) {
@@ -26,11 +26,11 @@ void v1_rolling_update_deployment_free(v1_rolling_update_deployment_t *v1_rollin
} }
listEntry_t *listEntry; listEntry_t *listEntry;
if (v1_rolling_update_deployment->max_surge) { if (v1_rolling_update_deployment->max_surge) {
object_free(v1_rolling_update_deployment->max_surge); int_or_string_free(v1_rolling_update_deployment->max_surge);
v1_rolling_update_deployment->max_surge = NULL; v1_rolling_update_deployment->max_surge = NULL;
} }
if (v1_rolling_update_deployment->max_unavailable) { if (v1_rolling_update_deployment->max_unavailable) {
object_free(v1_rolling_update_deployment->max_unavailable); int_or_string_free(v1_rolling_update_deployment->max_unavailable);
v1_rolling_update_deployment->max_unavailable = NULL; v1_rolling_update_deployment->max_unavailable = NULL;
} }
free(v1_rolling_update_deployment); free(v1_rolling_update_deployment);
@@ -41,26 +41,26 @@ cJSON *v1_rolling_update_deployment_convertToJSON(v1_rolling_update_deployment_t
// v1_rolling_update_deployment->max_surge // v1_rolling_update_deployment->max_surge
if(v1_rolling_update_deployment->max_surge) { if(v1_rolling_update_deployment->max_surge) {
cJSON *max_surge_object = object_convertToJSON(v1_rolling_update_deployment->max_surge); cJSON *max_surge_local_JSON = int_or_string_convertToJSON(v1_rolling_update_deployment->max_surge);
if(max_surge_object == NULL) { if(max_surge_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "maxSurge", max_surge_object); cJSON_AddItemToObject(item, "maxSurge", max_surge_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
// v1_rolling_update_deployment->max_unavailable // v1_rolling_update_deployment->max_unavailable
if(v1_rolling_update_deployment->max_unavailable) { if(v1_rolling_update_deployment->max_unavailable) {
cJSON *max_unavailable_object = object_convertToJSON(v1_rolling_update_deployment->max_unavailable); cJSON *max_unavailable_local_JSON = int_or_string_convertToJSON(v1_rolling_update_deployment->max_unavailable);
if(max_unavailable_object == NULL) { if(max_unavailable_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_object); cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
@@ -76,28 +76,40 @@ v1_rolling_update_deployment_t *v1_rolling_update_deployment_parseFromJSON(cJSON
v1_rolling_update_deployment_t *v1_rolling_update_deployment_local_var = NULL; v1_rolling_update_deployment_t *v1_rolling_update_deployment_local_var = NULL;
// define the local variable for v1_rolling_update_deployment->max_surge
int_or_string_t *max_surge_local_nonprim = NULL;
// define the local variable for v1_rolling_update_deployment->max_unavailable
int_or_string_t *max_unavailable_local_nonprim = NULL;
// v1_rolling_update_deployment->max_surge // v1_rolling_update_deployment->max_surge
cJSON *max_surge = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_deploymentJSON, "maxSurge"); cJSON *max_surge = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_deploymentJSON, "maxSurge");
object_t *max_surge_local_object = NULL;
if (max_surge) { if (max_surge) {
max_surge_local_object = object_parseFromJSON(max_surge); //object max_surge_local_nonprim = int_or_string_parseFromJSON(max_surge); //custom
} }
// v1_rolling_update_deployment->max_unavailable // v1_rolling_update_deployment->max_unavailable
cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_deploymentJSON, "maxUnavailable"); cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1_rolling_update_deploymentJSON, "maxUnavailable");
object_t *max_unavailable_local_object = NULL;
if (max_unavailable) { if (max_unavailable) {
max_unavailable_local_object = object_parseFromJSON(max_unavailable); //object max_unavailable_local_nonprim = int_or_string_parseFromJSON(max_unavailable); //custom
} }
v1_rolling_update_deployment_local_var = v1_rolling_update_deployment_create ( v1_rolling_update_deployment_local_var = v1_rolling_update_deployment_create (
max_surge ? max_surge_local_object : NULL, max_surge ? max_surge_local_nonprim : NULL,
max_unavailable ? max_unavailable_local_object : NULL max_unavailable ? max_unavailable_local_nonprim : NULL
); );
return v1_rolling_update_deployment_local_var; return v1_rolling_update_deployment_local_var;
end: end:
if (max_surge_local_nonprim) {
int_or_string_free(max_surge_local_nonprim);
max_surge_local_nonprim = NULL;
}
if (max_unavailable_local_nonprim) {
int_or_string_free(max_unavailable_local_nonprim);
max_unavailable_local_nonprim = NULL;
}
return NULL; return NULL;
} }

View File

@@ -15,19 +15,19 @@
typedef struct v1_rolling_update_deployment_t v1_rolling_update_deployment_t; typedef struct v1_rolling_update_deployment_t v1_rolling_update_deployment_t;
#include "object.h" #include "int_or_string.h"
typedef struct v1_rolling_update_deployment_t { typedef struct v1_rolling_update_deployment_t {
object_t *max_surge; //object int_or_string_t *max_surge; // custom
object_t *max_unavailable; //object int_or_string_t *max_unavailable; // custom
} v1_rolling_update_deployment_t; } v1_rolling_update_deployment_t;
v1_rolling_update_deployment_t *v1_rolling_update_deployment_create( v1_rolling_update_deployment_t *v1_rolling_update_deployment_create(
object_t *max_surge, int_or_string_t *max_surge,
object_t *max_unavailable int_or_string_t *max_unavailable
); );
void v1_rolling_update_deployment_free(v1_rolling_update_deployment_t *v1_rolling_update_deployment); void v1_rolling_update_deployment_free(v1_rolling_update_deployment_t *v1_rolling_update_deployment);

View File

@@ -11,7 +11,7 @@ v1_service_port_t *v1_service_port_create(
int node_port, int node_port,
int port, int port,
char *protocol, char *protocol,
object_t *target_port int_or_string_t *target_port
) { ) {
v1_service_port_t *v1_service_port_local_var = malloc(sizeof(v1_service_port_t)); v1_service_port_t *v1_service_port_local_var = malloc(sizeof(v1_service_port_t));
if (!v1_service_port_local_var) { if (!v1_service_port_local_var) {
@@ -46,7 +46,7 @@ void v1_service_port_free(v1_service_port_t *v1_service_port) {
v1_service_port->protocol = NULL; v1_service_port->protocol = NULL;
} }
if (v1_service_port->target_port) { if (v1_service_port->target_port) {
object_free(v1_service_port->target_port); int_or_string_free(v1_service_port->target_port);
v1_service_port->target_port = NULL; v1_service_port->target_port = NULL;
} }
free(v1_service_port); free(v1_service_port);
@@ -99,13 +99,13 @@ cJSON *v1_service_port_convertToJSON(v1_service_port_t *v1_service_port) {
// v1_service_port->target_port // v1_service_port->target_port
if(v1_service_port->target_port) { if(v1_service_port->target_port) {
cJSON *target_port_object = object_convertToJSON(v1_service_port->target_port); cJSON *target_port_local_JSON = int_or_string_convertToJSON(v1_service_port->target_port);
if(target_port_object == NULL) { if(target_port_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "targetPort", target_port_object); cJSON_AddItemToObject(item, "targetPort", target_port_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
@@ -121,6 +121,9 @@ v1_service_port_t *v1_service_port_parseFromJSON(cJSON *v1_service_portJSON){
v1_service_port_t *v1_service_port_local_var = NULL; v1_service_port_t *v1_service_port_local_var = NULL;
// define the local variable for v1_service_port->target_port
int_or_string_t *target_port_local_nonprim = NULL;
// v1_service_port->app_protocol // v1_service_port->app_protocol
cJSON *app_protocol = cJSON_GetObjectItemCaseSensitive(v1_service_portJSON, "appProtocol"); cJSON *app_protocol = cJSON_GetObjectItemCaseSensitive(v1_service_portJSON, "appProtocol");
if (app_protocol) { if (app_protocol) {
@@ -171,9 +174,8 @@ v1_service_port_t *v1_service_port_parseFromJSON(cJSON *v1_service_portJSON){
// v1_service_port->target_port // v1_service_port->target_port
cJSON *target_port = cJSON_GetObjectItemCaseSensitive(v1_service_portJSON, "targetPort"); cJSON *target_port = cJSON_GetObjectItemCaseSensitive(v1_service_portJSON, "targetPort");
object_t *target_port_local_object = NULL;
if (target_port) { if (target_port) {
target_port_local_object = object_parseFromJSON(target_port); //object target_port_local_nonprim = int_or_string_parseFromJSON(target_port); //custom
} }
@@ -183,11 +185,15 @@ v1_service_port_t *v1_service_port_parseFromJSON(cJSON *v1_service_portJSON){
node_port ? node_port->valuedouble : 0, node_port ? node_port->valuedouble : 0,
port->valuedouble, port->valuedouble,
protocol ? strdup(protocol->valuestring) : NULL, protocol ? strdup(protocol->valuestring) : NULL,
target_port ? target_port_local_object : NULL target_port ? target_port_local_nonprim : NULL
); );
return v1_service_port_local_var; return v1_service_port_local_var;
end: end:
if (target_port_local_nonprim) {
int_or_string_free(target_port_local_nonprim);
target_port_local_nonprim = NULL;
}
return NULL; return NULL;
} }

View File

@@ -15,7 +15,7 @@
typedef struct v1_service_port_t v1_service_port_t; typedef struct v1_service_port_t v1_service_port_t;
#include "object.h" #include "int_or_string.h"
@@ -25,7 +25,7 @@ typedef struct v1_service_port_t {
int node_port; //numeric int node_port; //numeric
int port; //numeric int port; //numeric
char *protocol; // string char *protocol; // string
object_t *target_port; //object int_or_string_t *target_port; // custom
} v1_service_port_t; } v1_service_port_t;
@@ -35,7 +35,7 @@ v1_service_port_t *v1_service_port_create(
int node_port, int node_port,
int port, int port,
char *protocol, char *protocol,
object_t *target_port int_or_string_t *target_port
); );
void v1_service_port_free(v1_service_port_t *v1_service_port); void v1_service_port_free(v1_service_port_t *v1_service_port);

View File

@@ -7,7 +7,7 @@
v1_tcp_socket_action_t *v1_tcp_socket_action_create( v1_tcp_socket_action_t *v1_tcp_socket_action_create(
char *host, char *host,
object_t *port int_or_string_t *port
) { ) {
v1_tcp_socket_action_t *v1_tcp_socket_action_local_var = malloc(sizeof(v1_tcp_socket_action_t)); v1_tcp_socket_action_t *v1_tcp_socket_action_local_var = malloc(sizeof(v1_tcp_socket_action_t));
if (!v1_tcp_socket_action_local_var) { if (!v1_tcp_socket_action_local_var) {
@@ -30,7 +30,7 @@ void v1_tcp_socket_action_free(v1_tcp_socket_action_t *v1_tcp_socket_action) {
v1_tcp_socket_action->host = NULL; v1_tcp_socket_action->host = NULL;
} }
if (v1_tcp_socket_action->port) { if (v1_tcp_socket_action->port) {
object_free(v1_tcp_socket_action->port); int_or_string_free(v1_tcp_socket_action->port);
v1_tcp_socket_action->port = NULL; v1_tcp_socket_action->port = NULL;
} }
free(v1_tcp_socket_action); free(v1_tcp_socket_action);
@@ -52,13 +52,13 @@ cJSON *v1_tcp_socket_action_convertToJSON(v1_tcp_socket_action_t *v1_tcp_socket_
goto fail; goto fail;
} }
cJSON *port_object = object_convertToJSON(v1_tcp_socket_action->port); cJSON *port_local_JSON = int_or_string_convertToJSON(v1_tcp_socket_action->port);
if(port_object == NULL) { if(port_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "port", port_object); cJSON_AddItemToObject(item, "port", port_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
return item; return item;
@@ -73,6 +73,9 @@ v1_tcp_socket_action_t *v1_tcp_socket_action_parseFromJSON(cJSON *v1_tcp_socket_
v1_tcp_socket_action_t *v1_tcp_socket_action_local_var = NULL; v1_tcp_socket_action_t *v1_tcp_socket_action_local_var = NULL;
// define the local variable for v1_tcp_socket_action->port
int_or_string_t *port_local_nonprim = NULL;
// v1_tcp_socket_action->host // v1_tcp_socket_action->host
cJSON *host = cJSON_GetObjectItemCaseSensitive(v1_tcp_socket_actionJSON, "host"); cJSON *host = cJSON_GetObjectItemCaseSensitive(v1_tcp_socket_actionJSON, "host");
if (host) { if (host) {
@@ -88,18 +91,21 @@ v1_tcp_socket_action_t *v1_tcp_socket_action_parseFromJSON(cJSON *v1_tcp_socket_
goto end; goto end;
} }
object_t *port_local_object = NULL;
port_local_object = object_parseFromJSON(port); //object port_local_nonprim = int_or_string_parseFromJSON(port); //custom
v1_tcp_socket_action_local_var = v1_tcp_socket_action_create ( v1_tcp_socket_action_local_var = v1_tcp_socket_action_create (
host ? strdup(host->valuestring) : NULL, host ? strdup(host->valuestring) : NULL,
port_local_object port_local_nonprim
); );
return v1_tcp_socket_action_local_var; return v1_tcp_socket_action_local_var;
end: end:
if (port_local_nonprim) {
int_or_string_free(port_local_nonprim);
port_local_nonprim = NULL;
}
return NULL; return NULL;
} }

View File

@@ -15,19 +15,19 @@
typedef struct v1_tcp_socket_action_t v1_tcp_socket_action_t; typedef struct v1_tcp_socket_action_t v1_tcp_socket_action_t;
#include "object.h" #include "int_or_string.h"
typedef struct v1_tcp_socket_action_t { typedef struct v1_tcp_socket_action_t {
char *host; // string char *host; // string
object_t *port; //object int_or_string_t *port; // custom
} v1_tcp_socket_action_t; } v1_tcp_socket_action_t;
v1_tcp_socket_action_t *v1_tcp_socket_action_create( v1_tcp_socket_action_t *v1_tcp_socket_action_create(
char *host, char *host,
object_t *port int_or_string_t *port
); );
void v1_tcp_socket_action_free(v1_tcp_socket_action_t *v1_tcp_socket_action); void v1_tcp_socket_action_free(v1_tcp_socket_action_t *v1_tcp_socket_action);

View File

@@ -6,8 +6,8 @@
v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_create( v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_create(
object_t *max_unavailable, int_or_string_t *max_unavailable,
object_t *min_available, int_or_string_t *min_available,
v1_label_selector_t *selector v1_label_selector_t *selector
) { ) {
v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_local_var = malloc(sizeof(v1beta1_pod_disruption_budget_spec_t)); v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_local_var = malloc(sizeof(v1beta1_pod_disruption_budget_spec_t));
@@ -28,11 +28,11 @@ void v1beta1_pod_disruption_budget_spec_free(v1beta1_pod_disruption_budget_spec_
} }
listEntry_t *listEntry; listEntry_t *listEntry;
if (v1beta1_pod_disruption_budget_spec->max_unavailable) { if (v1beta1_pod_disruption_budget_spec->max_unavailable) {
object_free(v1beta1_pod_disruption_budget_spec->max_unavailable); int_or_string_free(v1beta1_pod_disruption_budget_spec->max_unavailable);
v1beta1_pod_disruption_budget_spec->max_unavailable = NULL; v1beta1_pod_disruption_budget_spec->max_unavailable = NULL;
} }
if (v1beta1_pod_disruption_budget_spec->min_available) { if (v1beta1_pod_disruption_budget_spec->min_available) {
object_free(v1beta1_pod_disruption_budget_spec->min_available); int_or_string_free(v1beta1_pod_disruption_budget_spec->min_available);
v1beta1_pod_disruption_budget_spec->min_available = NULL; v1beta1_pod_disruption_budget_spec->min_available = NULL;
} }
if (v1beta1_pod_disruption_budget_spec->selector) { if (v1beta1_pod_disruption_budget_spec->selector) {
@@ -47,26 +47,26 @@ cJSON *v1beta1_pod_disruption_budget_spec_convertToJSON(v1beta1_pod_disruption_b
// v1beta1_pod_disruption_budget_spec->max_unavailable // v1beta1_pod_disruption_budget_spec->max_unavailable
if(v1beta1_pod_disruption_budget_spec->max_unavailable) { if(v1beta1_pod_disruption_budget_spec->max_unavailable) {
cJSON *max_unavailable_object = object_convertToJSON(v1beta1_pod_disruption_budget_spec->max_unavailable); cJSON *max_unavailable_local_JSON = int_or_string_convertToJSON(v1beta1_pod_disruption_budget_spec->max_unavailable);
if(max_unavailable_object == NULL) { if(max_unavailable_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_object); cJSON_AddItemToObject(item, "maxUnavailable", max_unavailable_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
// v1beta1_pod_disruption_budget_spec->min_available // v1beta1_pod_disruption_budget_spec->min_available
if(v1beta1_pod_disruption_budget_spec->min_available) { if(v1beta1_pod_disruption_budget_spec->min_available) {
cJSON *min_available_object = object_convertToJSON(v1beta1_pod_disruption_budget_spec->min_available); cJSON *min_available_local_JSON = int_or_string_convertToJSON(v1beta1_pod_disruption_budget_spec->min_available);
if(min_available_object == NULL) { if(min_available_local_JSON == NULL) {
goto fail; //model goto fail; // custom
} }
cJSON_AddItemToObject(item, "minAvailable", min_available_object); cJSON_AddItemToObject(item, "minAvailable", min_available_local_JSON);
if(item->child == NULL) { if(item->child == NULL) {
goto fail; goto fail;
} }
} }
@@ -95,21 +95,25 @@ v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_parseFr
v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_local_var = NULL; v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_local_var = NULL;
// define the local variable for v1beta1_pod_disruption_budget_spec->max_unavailable
int_or_string_t *max_unavailable_local_nonprim = NULL;
// define the local variable for v1beta1_pod_disruption_budget_spec->min_available
int_or_string_t *min_available_local_nonprim = NULL;
// define the local variable for v1beta1_pod_disruption_budget_spec->selector // define the local variable for v1beta1_pod_disruption_budget_spec->selector
v1_label_selector_t *selector_local_nonprim = NULL; v1_label_selector_t *selector_local_nonprim = NULL;
// v1beta1_pod_disruption_budget_spec->max_unavailable // v1beta1_pod_disruption_budget_spec->max_unavailable
cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1beta1_pod_disruption_budget_specJSON, "maxUnavailable"); cJSON *max_unavailable = cJSON_GetObjectItemCaseSensitive(v1beta1_pod_disruption_budget_specJSON, "maxUnavailable");
object_t *max_unavailable_local_object = NULL;
if (max_unavailable) { if (max_unavailable) {
max_unavailable_local_object = object_parseFromJSON(max_unavailable); //object max_unavailable_local_nonprim = int_or_string_parseFromJSON(max_unavailable); //custom
} }
// v1beta1_pod_disruption_budget_spec->min_available // v1beta1_pod_disruption_budget_spec->min_available
cJSON *min_available = cJSON_GetObjectItemCaseSensitive(v1beta1_pod_disruption_budget_specJSON, "minAvailable"); cJSON *min_available = cJSON_GetObjectItemCaseSensitive(v1beta1_pod_disruption_budget_specJSON, "minAvailable");
object_t *min_available_local_object = NULL;
if (min_available) { if (min_available) {
min_available_local_object = object_parseFromJSON(min_available); //object min_available_local_nonprim = int_or_string_parseFromJSON(min_available); //custom
} }
// v1beta1_pod_disruption_budget_spec->selector // v1beta1_pod_disruption_budget_spec->selector
@@ -120,13 +124,21 @@ v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_parseFr
v1beta1_pod_disruption_budget_spec_local_var = v1beta1_pod_disruption_budget_spec_create ( v1beta1_pod_disruption_budget_spec_local_var = v1beta1_pod_disruption_budget_spec_create (
max_unavailable ? max_unavailable_local_object : NULL, max_unavailable ? max_unavailable_local_nonprim : NULL,
min_available ? min_available_local_object : NULL, min_available ? min_available_local_nonprim : NULL,
selector ? selector_local_nonprim : NULL selector ? selector_local_nonprim : NULL
); );
return v1beta1_pod_disruption_budget_spec_local_var; return v1beta1_pod_disruption_budget_spec_local_var;
end: end:
if (max_unavailable_local_nonprim) {
int_or_string_free(max_unavailable_local_nonprim);
max_unavailable_local_nonprim = NULL;
}
if (min_available_local_nonprim) {
int_or_string_free(min_available_local_nonprim);
min_available_local_nonprim = NULL;
}
if (selector_local_nonprim) { if (selector_local_nonprim) {
v1_label_selector_free(selector_local_nonprim); v1_label_selector_free(selector_local_nonprim);
selector_local_nonprim = NULL; selector_local_nonprim = NULL;

View File

@@ -15,21 +15,21 @@
typedef struct v1beta1_pod_disruption_budget_spec_t v1beta1_pod_disruption_budget_spec_t; typedef struct v1beta1_pod_disruption_budget_spec_t v1beta1_pod_disruption_budget_spec_t;
#include "object.h" #include "int_or_string.h"
#include "v1_label_selector.h" #include "v1_label_selector.h"
typedef struct v1beta1_pod_disruption_budget_spec_t { typedef struct v1beta1_pod_disruption_budget_spec_t {
object_t *max_unavailable; //object int_or_string_t *max_unavailable; // custom
object_t *min_available; //object int_or_string_t *min_available; // custom
struct v1_label_selector_t *selector; //model struct v1_label_selector_t *selector; //model
} v1beta1_pod_disruption_budget_spec_t; } v1beta1_pod_disruption_budget_spec_t;
v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_create( v1beta1_pod_disruption_budget_spec_t *v1beta1_pod_disruption_budget_spec_create(
object_t *max_unavailable, int_or_string_t *max_unavailable,
object_t *min_available, int_or_string_t *min_available,
v1_label_selector_t *selector v1_label_selector_t *selector
); );

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ v1_http_get_action_t* instantiate_v1_http_get_action(int include_optional) {
"0", "0",
list_create(), list_create(),
"0", "0",
0, "0",
"0" "0"
); );
} else { } else {
@@ -33,7 +33,7 @@ v1_http_get_action_t* instantiate_v1_http_get_action(int include_optional) {
"0", "0",
list_create(), list_create(),
"0", "0",
0, "0",
"0" "0"
); );
} }

View File

@@ -23,13 +23,13 @@ v1_network_policy_port_t* instantiate_v1_network_policy_port(int include_optiona
if (include_optional) { if (include_optional) {
v1_network_policy_port = v1_network_policy_port_create( v1_network_policy_port = v1_network_policy_port_create(
56, 56,
0, "0",
"0" "0"
); );
} else { } else {
v1_network_policy_port = v1_network_policy_port_create( v1_network_policy_port = v1_network_policy_port_create(
56, 56,
0, "0",
"0" "0"
); );
} }

View File

@@ -23,15 +23,15 @@ v1_pod_disruption_budget_spec_t* instantiate_v1_pod_disruption_budget_spec(int i
v1_pod_disruption_budget_spec_t* v1_pod_disruption_budget_spec = NULL; v1_pod_disruption_budget_spec_t* v1_pod_disruption_budget_spec = NULL;
if (include_optional) { if (include_optional) {
v1_pod_disruption_budget_spec = v1_pod_disruption_budget_spec_create( v1_pod_disruption_budget_spec = v1_pod_disruption_budget_spec_create(
0, "0",
0, "0",
// false, not to have infinite recursion // false, not to have infinite recursion
instantiate_v1_label_selector(0) instantiate_v1_label_selector(0)
); );
} else { } else {
v1_pod_disruption_budget_spec = v1_pod_disruption_budget_spec_create( v1_pod_disruption_budget_spec = v1_pod_disruption_budget_spec_create(
0, "0",
0, "0",
NULL NULL
); );
} }

View File

@@ -22,13 +22,13 @@ v1_rolling_update_daemon_set_t* instantiate_v1_rolling_update_daemon_set(int inc
v1_rolling_update_daemon_set_t* v1_rolling_update_daemon_set = NULL; v1_rolling_update_daemon_set_t* v1_rolling_update_daemon_set = NULL;
if (include_optional) { if (include_optional) {
v1_rolling_update_daemon_set = v1_rolling_update_daemon_set_create( v1_rolling_update_daemon_set = v1_rolling_update_daemon_set_create(
0, "0",
0 "0"
); );
} else { } else {
v1_rolling_update_daemon_set = v1_rolling_update_daemon_set_create( v1_rolling_update_daemon_set = v1_rolling_update_daemon_set_create(
0, "0",
0 "0"
); );
} }

View File

@@ -22,13 +22,13 @@ v1_rolling_update_deployment_t* instantiate_v1_rolling_update_deployment(int inc
v1_rolling_update_deployment_t* v1_rolling_update_deployment = NULL; v1_rolling_update_deployment_t* v1_rolling_update_deployment = NULL;
if (include_optional) { if (include_optional) {
v1_rolling_update_deployment = v1_rolling_update_deployment_create( v1_rolling_update_deployment = v1_rolling_update_deployment_create(
0, "0",
0 "0"
); );
} else { } else {
v1_rolling_update_deployment = v1_rolling_update_deployment_create( v1_rolling_update_deployment = v1_rolling_update_deployment_create(
0, "0",
0 "0"
); );
} }

View File

@@ -27,7 +27,7 @@ v1_service_port_t* instantiate_v1_service_port(int include_optional) {
56, 56,
56, 56,
"0", "0",
0 "0"
); );
} else { } else {
v1_service_port = v1_service_port_create( v1_service_port = v1_service_port_create(
@@ -36,7 +36,7 @@ v1_service_port_t* instantiate_v1_service_port(int include_optional) {
56, 56,
56, 56,
"0", "0",
0 "0"
); );
} }

View File

@@ -23,12 +23,12 @@ v1_tcp_socket_action_t* instantiate_v1_tcp_socket_action(int include_optional) {
if (include_optional) { if (include_optional) {
v1_tcp_socket_action = v1_tcp_socket_action_create( v1_tcp_socket_action = v1_tcp_socket_action_create(
"0", "0",
0 "0"
); );
} else { } else {
v1_tcp_socket_action = v1_tcp_socket_action_create( v1_tcp_socket_action = v1_tcp_socket_action_create(
"0", "0",
0 "0"
); );
} }

View File

@@ -23,15 +23,15 @@ v1beta1_pod_disruption_budget_spec_t* instantiate_v1beta1_pod_disruption_budget_
v1beta1_pod_disruption_budget_spec_t* v1beta1_pod_disruption_budget_spec = NULL; v1beta1_pod_disruption_budget_spec_t* v1beta1_pod_disruption_budget_spec = NULL;
if (include_optional) { if (include_optional) {
v1beta1_pod_disruption_budget_spec = v1beta1_pod_disruption_budget_spec_create( v1beta1_pod_disruption_budget_spec = v1beta1_pod_disruption_budget_spec_create(
0, "0",
0, "0",
// false, not to have infinite recursion // false, not to have infinite recursion
instantiate_v1_label_selector(0) instantiate_v1_label_selector(0)
); );
} else { } else {
v1beta1_pod_disruption_budget_spec = v1beta1_pod_disruption_budget_spec_create( v1beta1_pod_disruption_budget_spec = v1beta1_pod_disruption_budget_spec_create(
0, "0",
0, "0",
NULL NULL
); );
} }