Commit 44f97f30 authored by Michel Roy's avatar Michel Roy Committed by Kevin Di Lallo
Browse files

demo1 server swagger update

parent 123fb865
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)

- API version: 0.0.1
- Build date: 2019-11-01T08:58:51.886-04:00
- Build date: 2019-11-07T07:57:52.497-05:00


### Running the server
+0 −25
Original line number Diff line number Diff line
@@ -10,35 +10,10 @@
package server

import (
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"strings"
)

func GetEdgeInfo(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")

	var edgeInfo EdgeInfo
	//podName := os.Getenv("MEEP_POD_NAME")
	serviceName := os.Getenv("MGM_APP_ID")
	newString := strings.ToUpper(serviceName) + "_SERVICE_HOST"
	newString = strings.Replace(newString, "-", "_", -1)

	svcName := os.Getenv("MGM_GROUP_NAME")

	edgeInfo.Svc = svcName
	edgeInfo.Name = serviceName //podName
	edgeInfo.Ip = os.Getenv(newString)
	// Format response
	jsonResponse, err := json.Marshal(edgeInfo)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	// Send response
	w.WriteHeader(http.StatusOK)
	fmt.Fprint(w, string(jsonResponse))
}
+2 −2
Original line number Diff line number Diff line
@@ -14,6 +14,6 @@ import (
)

func PostTrackingNotification(w http.ResponseWriter, r *http.Request) {
	localDBUpdateTrackedUes(w, r)

	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	w.WriteHeader(http.StatusOK)
}
+2 −1
Original line number Diff line number Diff line
@@ -14,5 +14,6 @@ import (
)

func HandleEvent(w http.ResponseWriter, r *http.Request) {
	localDBHandleEvent(w, r)
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
	w.WriteHeader(http.StatusOK)
}
+2 −23
Original line number Diff line number Diff line
@@ -11,30 +11,9 @@ package server

import (
	"net/http"
        "github.com/gorilla/mux"
        "fmt"
        "encoding/json"
	"log"
)

func GetUeLocation(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("Content-Type", "application/json; charset=UTF-8")
        vars := mux.Vars(r)
        ueId := vars["ueId"]

        userInfo := getLocalDBUserInfo(ueId)

	if userInfo != nil {
	        jsonResponse, err := json.Marshal(userInfo)

		fmt.Fprintf(w, string(jsonResponse))

		if err != nil {
                	log.Printf(err.Error())
	                http.Error(w, err.Error(), http.StatusInternalServerError)
       		        return
		}
        }
	w.WriteHeader(http.StatusOK)

}
Loading