Merge pull request #1499 from k4s0/develop

added new controller for creating custom ExtClient
This commit is contained in:
Alex Feiszli 2022-09-02 14:49:58 -04:00 committed by GitHub
commit a95e0d25c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -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)

View file

@ -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"`