|
@@ -43,14 +43,13 @@ func checkIngressExists(nodeID string) bool {
|
|
// Get all extclients associated with network.
|
|
// Get all extclients associated with network.
|
|
// Gets all extclients associated with network, including pending extclients.
|
|
// Gets all extclients associated with network, including pending extclients.
|
|
//
|
|
//
|
|
-// Schemes: https
|
|
|
|
|
|
+// Schemes: https
|
|
//
|
|
//
|
|
-// Security:
|
|
|
|
-// oauth
|
|
|
|
-//
|
|
|
|
-// Responses:
|
|
|
|
-// 200: extClientSliceResponse
|
|
|
|
|
|
+// Security:
|
|
|
|
+// oauth
|
|
//
|
|
//
|
|
|
|
+// Responses:
|
|
|
|
+// 200: extClientSliceResponse
|
|
func getNetworkExtClients(w http.ResponseWriter, r *http.Request) {
|
|
func getNetworkExtClients(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Header().Set("Content-Type", "application/json")
|
|
@@ -75,14 +74,13 @@ func getNetworkExtClients(w http.ResponseWriter, r *http.Request) {
|
|
//
|
|
//
|
|
// A separate function to get all extclients, not just extclients for a particular network.
|
|
// A separate function to get all extclients, not just extclients for a particular network.
|
|
//
|
|
//
|
|
|
|
+// Schemes: https
|
|
//
|
|
//
|
|
-// Schemes: https
|
|
|
|
-//
|
|
|
|
-// Security:
|
|
|
|
-// oauth
|
|
|
|
|
|
+// Security:
|
|
|
|
+// oauth
|
|
//
|
|
//
|
|
-// Responses:
|
|
|
|
-// 200: extClientSliceResponse
|
|
|
|
|
|
+// Responses:
|
|
|
|
+// 200: extClientSliceResponse
|
|
//
|
|
//
|
|
// Not quite sure if this is necessary. Probably necessary based on front end but may
|
|
// Not quite sure if this is necessary. Probably necessary based on front end but may
|
|
// want to review after iteration 1 if it's being used or not
|
|
// want to review after iteration 1 if it's being used or not
|
|
@@ -126,14 +124,13 @@ func getAllExtClients(w http.ResponseWriter, r *http.Request) {
|
|
//
|
|
//
|
|
// Get an individual extclient.
|
|
// Get an individual extclient.
|
|
//
|
|
//
|
|
-// Schemes: https
|
|
|
|
|
|
+// Schemes: https
|
|
//
|
|
//
|
|
-// Security:
|
|
|
|
-// oauth
|
|
|
|
-//
|
|
|
|
-// Responses:
|
|
|
|
-// 200: extClientResponse
|
|
|
|
|
|
+// Security:
|
|
|
|
+// oauth
|
|
//
|
|
//
|
|
|
|
+// Responses:
|
|
|
|
+// 200: extClientResponse
|
|
func getExtClient(w http.ResponseWriter, r *http.Request) {
|
|
func getExtClient(w http.ResponseWriter, r *http.Request) {
|
|
// set header.
|
|
// set header.
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Header().Set("Content-Type", "application/json")
|
|
@@ -158,14 +155,13 @@ func getExtClient(w http.ResponseWriter, r *http.Request) {
|
|
//
|
|
//
|
|
// Get an individual extclient.
|
|
// Get an individual extclient.
|
|
//
|
|
//
|
|
-// Schemes: https
|
|
|
|
-//
|
|
|
|
-// Security:
|
|
|
|
-// oauth
|
|
|
|
|
|
+// Schemes: https
|
|
//
|
|
//
|
|
-// Responses:
|
|
|
|
-// 200: extClientResponse
|
|
|
|
|
|
+// Security:
|
|
|
|
+// oauth
|
|
//
|
|
//
|
|
|
|
+// Responses:
|
|
|
|
+// 200: extClientResponse
|
|
func getExtClientConf(w http.ResponseWriter, r *http.Request) {
|
|
func getExtClientConf(w http.ResponseWriter, r *http.Request) {
|
|
// set header.
|
|
// set header.
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Header().Set("Content-Type", "application/json")
|
|
@@ -288,16 +284,18 @@ Endpoint = %s
|
|
w.WriteHeader(http.StatusOK)
|
|
w.WriteHeader(http.StatusOK)
|
|
json.NewEncoder(w).Encode(client)
|
|
json.NewEncoder(w).Encode(client)
|
|
}
|
|
}
|
|
|
|
+func getFreeIpFromIngressExtCIDR() string {
|
|
|
|
+ return "10.235.166.20"
|
|
|
|
+}
|
|
|
|
|
|
// swagger:route POST /api/extclients/{network}/{nodeid} ext_client createExtClient
|
|
// swagger:route POST /api/extclients/{network}/{nodeid} ext_client createExtClient
|
|
//
|
|
//
|
|
// Create an individual extclient. Must have valid key and be unique.
|
|
// Create an individual extclient. Must have valid key and be unique.
|
|
//
|
|
//
|
|
-// Schemes: https
|
|
|
|
-//
|
|
|
|
-// Security:
|
|
|
|
-// oauth
|
|
|
|
|
|
+// Schemes: https
|
|
//
|
|
//
|
|
|
|
+// Security:
|
|
|
|
+// oauth
|
|
func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|
func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
|
|
@@ -325,6 +323,7 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
extclient.Network = networkName
|
|
extclient.Network = networkName
|
|
extclient.IngressGatewayID = nodeid
|
|
extclient.IngressGatewayID = nodeid
|
|
|
|
+ extclient.InternalIP = getFreeIpFromIngressExtCIDR()
|
|
node, err := logic.GetNodeByID(nodeid)
|
|
node, err := logic.GetNodeByID(nodeid)
|
|
if err != nil {
|
|
if err != nil {
|
|
logger.Log(0, r.Header.Get("user"),
|
|
logger.Log(0, r.Header.Get("user"),
|
|
@@ -385,14 +384,13 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|
//
|
|
//
|
|
// Update an individual extclient.
|
|
// Update an individual extclient.
|
|
//
|
|
//
|
|
-// Schemes: https
|
|
|
|
|
|
+// Schemes: https
|
|
//
|
|
//
|
|
-// Security:
|
|
|
|
-// oauth
|
|
|
|
-//
|
|
|
|
-// Responses:
|
|
|
|
-// 200: extClientResponse
|
|
|
|
|
|
+// Security:
|
|
|
|
+// oauth
|
|
//
|
|
//
|
|
|
|
+// Responses:
|
|
|
|
+// 200: extClientResponse
|
|
func updateExtClient(w http.ResponseWriter, r *http.Request) {
|
|
func updateExtClient(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
|
|
@@ -480,14 +478,13 @@ func updateExtClient(w http.ResponseWriter, r *http.Request) {
|
|
//
|
|
//
|
|
// Delete an individual extclient.
|
|
// Delete an individual extclient.
|
|
//
|
|
//
|
|
-// Schemes: https
|
|
|
|
-//
|
|
|
|
-// Security:
|
|
|
|
-// oauth
|
|
|
|
|
|
+// Schemes: https
|
|
//
|
|
//
|
|
-// Responses:
|
|
|
|
-// 200: successResponse
|
|
|
|
|
|
+// Security:
|
|
|
|
+// oauth
|
|
//
|
|
//
|
|
|
|
+// Responses:
|
|
|
|
+// 200: successResponse
|
|
func deleteExtClient(w http.ResponseWriter, r *http.Request) {
|
|
func deleteExtClient(w http.ResponseWriter, r *http.Request) {
|
|
// Set header
|
|
// Set header
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Header().Set("Content-Type", "application/json")
|