Skip to content

Commit 0c3a731

Browse files
committed
improve generic list and namespacedlist
- allow empty apiGroup - select rest api path based on apiGroup value
1 parent 64651d8 commit 0c3a731

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kubernetes/src/generic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ char* Generic_readResource(genericClient_t *client, const char *name) {
9595

9696
char *Generic_listNamespaced(genericClient_t *client, const char *namespace) {
9797
char path[128];
98-
if (client->apiGroup) {
98+
if (client->apiGroup && strlen(client->apiGroup)) {
9999
snprintf(path, 128, "/apis/%s/%s/namespaces/%s/%s",
100100
client->apiGroup, client->apiVersion, namespace, client->resourcePlural);
101101
} else {
@@ -107,7 +107,7 @@ char *Generic_listNamespaced(genericClient_t *client, const char *namespace) {
107107

108108
char *Generic_list(genericClient_t *client) {
109109
char path[128];
110-
if (client->apiGroup) {
110+
if (client->apiGroup && strlen(client->apiGroup)) {
111111
snprintf(path, 128, "/apis/%s/%s/%s",
112112
client->apiGroup, client->apiVersion, client->resourcePlural);
113113
} else {

0 commit comments

Comments
 (0)