mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
Merge pull request #1499 from k4s0/develop
added new controller for creating custom ExtClient
This commit is contained in:
commit
a95e0d25c6
|
@ -248,9 +248,9 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
var params = mux.Vars(r)
|
||||
|
||||
networkName := params["network"]
|
||||
nodeid := params["nodeid"]
|
||||
|
||||
ingressExists := checkIngressExists(nodeid)
|
||||
if !ingressExists {
|
||||
err := errors.New("ingress does not exist")
|
||||
|
@ -261,6 +261,12 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
var extclient models.ExtClient
|
||||
var CustomExtClient models.CustomExtClient
|
||||
|
||||
err := json.NewDecoder(r.Body).Decode(&CustomExtClient);
|
||||
|
||||
if err == nil { extclient.ClientID = CustomExtClient.ClientID }
|
||||
|
||||
extclient.Network = networkName
|
||||
extclient.IngressGatewayID = nodeid
|
||||
node, err := logic.GetNodeByID(nodeid)
|
||||
|
|
|
@ -10,6 +10,11 @@ import (
|
|||
const PLACEHOLDER_KEY_TEXT = "ACCESS_KEY"
|
||||
const PLACEHOLDER_TOKEN_TEXT = "ACCESS_TOKEN"
|
||||
|
||||
// CustomExtClient - struct for CustomExtClient params
|
||||
type CustomExtClient struct {
|
||||
ClientID string `json:"clientid"`
|
||||
}
|
||||
|
||||
// AuthParams - struct for auth params
|
||||
type AuthParams struct {
|
||||
MacAddress string `json:"macaddress"`
|
||||
|
|
Loading…
Reference in a new issue