@@ -86,16 +86,16 @@ list all pods:
86
86
pod_list = CoreV1API_listNamespacedPod(apiClient,
87
87
"default", /*namespace */
88
88
NULL, /* pretty */
89
- 0, /* allowWatchBookmarks */
89
+ NULL, /* allowWatchBookmarks */
90
90
NULL, /* continue */
91
91
NULL, /* fieldSelector */
92
92
NULL, /* labelSelector */
93
- 0, /* limit */
93
+ NULL, /* limit */
94
94
NULL, /* resourceVersion */
95
95
NULL, /* resourceVersionMatch */
96
- 0, /* sendInitialEvents */
97
- 0, /* timeoutSeconds */
98
- 0 /* watch */
96
+ NULL, /* sendInitialEvents */
97
+ NULL, /* timeoutSeconds */
98
+ NULL /* watch */
99
99
);
100
100
printf ("return code=%ld\n", apiClient->response_code);
101
101
if (pod_list) {
@@ -132,16 +132,16 @@ list all pods in cluster:
132
132
pod_list = CoreV1API_listNamespacedPod(apiClient,
133
133
"default", /*namespace */
134
134
NULL, /* pretty */
135
- 0, /* allowWatchBookmarks */
135
+ NULL, /* allowWatchBookmarks */
136
136
NULL, /* continue */
137
137
NULL, /* fieldSelector */
138
138
NULL, /* labelSelector */
139
- 0, /* limit */
139
+ NULL, /* limit */
140
140
NULL, /* resourceVersion */
141
141
NULL, /* resourceVersionMatch */
142
- 0, /* sendInitialEvents */
143
- 0, /* timeoutSeconds */
144
- 0 /* watch */
142
+ NULL, /* sendInitialEvents */
143
+ NULL, /* timeoutSeconds */
144
+ NULL /* watch */
145
145
);
146
146
printf("return code=%ld\n", apiClient->response_code);
147
147
if (pod_list) {
@@ -157,6 +157,50 @@ list all pods in cluster:
157
157
apiClient_unsetupGlobalEnv();
158
158
```
159
159
160
+ ## How to send integer or boolean parameters to API Server
161
+
162
+ If you want to send an integer or boolean parameter to the API server, you will see that the data type in API function is ` int * ` , e.g.
163
+
164
+ ``` c
165
+ // list or watch objects of kind Pod
166
+ //
167
+ v1_pod_list_t * CoreV1API_listNamespacedPod (apiClient_t * apiClient,
168
+ char * _ namespace,
169
+ char * pretty,
170
+ int * allowWatchBookmarks, /* <-- here * /
171
+ char * _ continue,
172
+ char * fieldSelector,
173
+ char * labelSelector,
174
+ int * limit, /* <-- here * /
175
+ char * resourceVersion,
176
+ char * resourceVersionMatch,
177
+ int * sendInitialEvents, /* <-- here * /
178
+ int * timeoutSeconds, /* <-- here * /
179
+ int * watch); /* <-- here * /
180
+ ```
181
+
182
+ For example we can send `timeoutSeconds` and `watch` using the following usage:
183
+
184
+ ```c
185
+ int timeoutSeconds = 30;
186
+ int watch = 1;
187
+ pod_list = CoreV1API_listNamespacedPod(apiClient, "default", /*namespace */
188
+ NULL, /* pretty */
189
+ NULL, /* allowWatchBookmarks */
190
+ NULL, /* continue */
191
+ NULL, /* fieldSelector */
192
+ NULL, /* labelSelector */
193
+ NULL, /* limit */
194
+ NULL, /* resourceVersion */
195
+ NULL, /* resourceVersionMatch */
196
+ NULL, /* sendInitialEvents */
197
+ &timeoutSeconds, /* timeoutSeconds */
198
+ &watch /* watch */
199
+ );
200
+ ```
201
+
202
+ Setting the parameter to ` NULL ` means not to send the parameter to the API Server, and the API Server will use the default value for this parameter.
203
+
160
204
## Aggregated APIs and CRD-based APIs
161
205
162
206
If you want to implement a client for aggregated APIs (such as the metrics server API ` apis/metrics.k8s.io ` ) or CRD-based APIs, use the [ generic client] ( ./kubernetes/src/generic.c ) . See [ example] ( ./examples/generic/main.c ) .
0 commit comments