add loadbalance endpoint for extclients

This commit is contained in:
abhishek9686
2025-03-02 20:59:27 +04:00
parent 33fafa83e6
commit 76311f072d
2 changed files with 16 additions and 0 deletions

View File

@@ -17,6 +17,17 @@ var extClientConfigCmd = &cobra.Command{
},
}
var extClientHAConfigCmd = &cobra.Command{
Use: "auto_config [NETWORK NAME]",
Args: cobra.ExactArgs(1),
Short: "Get an External Client Configuration",
Long: `Get an External Client Configuration`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(functions.GetExtClientHAConfig(args[0]))
},
}
func init() {
rootCmd.AddCommand(extClientConfigCmd)
rootCmd.AddCommand(extClientHAConfigCmd)
}

View File

@@ -27,6 +27,11 @@ func GetExtClientConfig(networkName, clientID string) string {
return get(fmt.Sprintf("/api/extclients/%s/%s/file", networkName, clientID))
}
// GetExtClientConfig - auto fetch a client config
func GetExtClientHAConfig(networkName string) string {
return get(fmt.Sprintf("/api/v1/client_conf/%s", networkName))
}
// CreateExtClient - create an external client
func CreateExtClient(networkName, nodeID string, extClient models.CustomExtClient) {
request[any](http.MethodPost, fmt.Sprintf("/api/extclients/%s/%s", networkName, nodeID), extClient)