Skip to content

Commit 6409031

Browse files
committed
Update readme after the data types of function prameters changes from "int" to "int*"
1 parent 83799e2 commit 6409031

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed

README.md

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,16 @@ list all pods:
8686
pod_list = CoreV1API_listNamespacedPod(apiClient,
8787
"default", /*namespace */
8888
NULL, /* pretty */
89-
0, /* allowWatchBookmarks */
89+
NULL, /* allowWatchBookmarks */
9090
NULL, /* continue */
9191
NULL, /* fieldSelector */
9292
NULL, /* labelSelector */
93-
0, /* limit */
93+
NULL, /* limit */
9494
NULL, /* resourceVersion */
9595
NULL, /* resourceVersionMatch */
96-
0, /* sendInitialEvents */
97-
0, /* timeoutSeconds */
98-
0 /* watch */
96+
NULL, /* sendInitialEvents */
97+
NULL, /* timeoutSeconds */
98+
NULL /* watch */
9999
);
100100
printf("return code=%ld\n", apiClient->response_code);
101101
if (pod_list) {
@@ -132,16 +132,16 @@ list all pods in cluster:
132132
pod_list = CoreV1API_listNamespacedPod(apiClient,
133133
"default", /*namespace */
134134
NULL, /* pretty */
135-
0, /* allowWatchBookmarks */
135+
NULL, /* allowWatchBookmarks */
136136
NULL, /* continue */
137137
NULL, /* fieldSelector */
138138
NULL, /* labelSelector */
139-
0, /* limit */
139+
NULL, /* limit */
140140
NULL, /* resourceVersion */
141141
NULL, /* resourceVersionMatch */
142-
0, /* sendInitialEvents */
143-
0, /* timeoutSeconds */
144-
0 /* watch */
142+
NULL, /* sendInitialEvents */
143+
NULL, /* timeoutSeconds */
144+
NULL /* watch */
145145
);
146146
printf("return code=%ld\n", apiClient->response_code);
147147
if (pod_list) {
@@ -157,6 +157,50 @@ list all pods in cluster:
157157
apiClient_unsetupGlobalEnv();
158158
```
159159

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+
160204
## Aggregated APIs and CRD-based APIs
161205

162206
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

Comments
 (0)