mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-27 19:00:25 +08:00
add loadbalance endpoint for extclients
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user