mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-28 11:11:33 +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() {
|
func init() {
|
||||||
rootCmd.AddCommand(extClientConfigCmd)
|
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))
|
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
|
// CreateExtClient - create an external client
|
||||||
func CreateExtClient(networkName, nodeID string, extClient models.CustomExtClient) {
|
func CreateExtClient(networkName, nodeID string, extClient models.CustomExtClient) {
|
||||||
request[any](http.MethodPost, fmt.Sprintf("/api/extclients/%s/%s", networkName, nodeID), extClient)
|
request[any](http.MethodPost, fmt.Sprintf("/api/extclients/%s/%s", networkName, nodeID), extClient)
|
||||||
|
|||||||
Reference in New Issue
Block a user