Skip to content

Commit

Permalink
improve generic list and namespacedlist
Browse files Browse the repository at this point in the history
- allow empty apiGroup
- select rest api path based on apiGroup value
  • Loading branch information
DanyT committed Apr 21, 2023
1 parent 64651d8 commit 0c3a731
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kubernetes/src/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ char* Generic_readResource(genericClient_t *client, const char *name) {

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

char *Generic_list(genericClient_t *client) {
char path[128];
if (client->apiGroup) {
if (client->apiGroup && strlen(client->apiGroup)) {
snprintf(path, 128, "/apis/%s/%s/%s",
client->apiGroup, client->apiVersion, client->resourcePlural);
} else {
Expand Down

0 comments on commit 0c3a731

Please sign in to comment.