- existing api is not changed - load_kube_config works as before - extend kubeconfig_t to hold in memory buffer - make a common flow for file/buffer code - set fileName/buffer members accordingly - provide new api: load_kube_config_buffer
121 lines
2.1 KiB
C
121 lines
2.1 KiB
C
#ifndef _KUBE_CONFIG_H
|
|
#define _KUBE_CONFIG_H
|
|
|
|
#include "../include/apiClient.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
* load_kube_config
|
|
*
|
|
*
|
|
* Description:
|
|
*
|
|
*
|
|
* Load kubernetes cluster configuration from the file specified
|
|
* by parameter or default location: $HOME/.kube/config
|
|
*
|
|
*
|
|
* Return:
|
|
*
|
|
* 0 Success
|
|
* -1 Failed
|
|
*
|
|
*
|
|
* Parameter:
|
|
*
|
|
*
|
|
* IN:
|
|
|
|
* configFileName : kubernetes cluster configuration file name
|
|
*
|
|
*
|
|
* OUT:
|
|
*
|
|
* pBasePath: The pointer to API server address
|
|
* pSslConfig: The pointer to SSL configuration for client
|
|
* pApiKeys: The pointer to API tokens for client
|
|
*
|
|
* The memory will be allocated inside this function. User
|
|
* should call free_client_config to free the memory after
|
|
* these parameters are not used.
|
|
*
|
|
*/
|
|
|
|
int load_kube_config(char **pBasePath, sslConfig_t ** pSslConfig, list_t ** pApiKeys, const char *configFileName);
|
|
|
|
/*
|
|
* load_kube_config_buffer
|
|
*
|
|
*
|
|
* Description:
|
|
*
|
|
*
|
|
* Load kubernetes cluster configuration from specfied buffer
|
|
*
|
|
*
|
|
* Return:
|
|
*
|
|
* 0 Success
|
|
* -1 Failed
|
|
*
|
|
*
|
|
* Parameter:
|
|
*
|
|
*
|
|
* IN:
|
|
|
|
* buffer : kubernetes cluster configuration data
|
|
*
|
|
*
|
|
* OUT:
|
|
*
|
|
* pBasePath: The pointer to API server address
|
|
* pSslConfig: The pointer to SSL configuration for client
|
|
* pApiKeys: The pointer to API tokens for client
|
|
*
|
|
* The memory will be allocated inside this function. User
|
|
* should call free_client_config to free the memory after
|
|
* these parameters are not used.
|
|
*
|
|
*/
|
|
|
|
int load_kube_config_buffer(char **pBasePath, sslConfig_t ** pSslConfig, list_t ** pApiKeys, const char *buffer);
|
|
|
|
/*
|
|
* free_client_config
|
|
*
|
|
*
|
|
* Description:
|
|
*
|
|
* Help function to free the memory for the client configuration
|
|
*
|
|
*
|
|
* Return:
|
|
*
|
|
* None
|
|
*
|
|
*
|
|
* Parameter:
|
|
*
|
|
* IN:
|
|
*
|
|
* basePath: API server address
|
|
* sslConfig: SSL configuration for client
|
|
* apiKeys: API tokens for client
|
|
*
|
|
* OUT:
|
|
*
|
|
* None
|
|
*
|
|
*/
|
|
|
|
void free_client_config(char *basePath, sslConfig_t * sslConfig, list_t * apiKeys);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* _KUBE_CONFIG_H */
|