func (c *MecHostController) UpdateMecHost() {
	log.Info("Add or Update mec host request received.")
	c.AddMecHost()
}
@Title Update MEC host
@Description Add mec host information
@Param   body        body    models.MecHostInfo   true      "The mec host information"
@Success 200 ok
@Failure 400 bad request
@router /hosts [put]
package controllers
import (
	"encoding/json"
	log "github.com/sirupsen/logrus"
	"lcmcontroller/config"
	"lcmcontroller/models"
	"lcmcontroller/util"
	"strings"
)
type MecHostController struct {
	BaseController
}
func (c *MecHostController) AddMecHost() {
	log.Info("Add or update mec host request received.")
	clientIp := c.Ctx.Input.IP()
	err := util.ValidateSrcAddress(clientIp)
	if err != nil {
		c.HandleLoggingForError(clientIp, util.BadRequest, util.ClientIpaddressInvalid)
		return
	}
	c.displayReceivedMsg(clientIp)
	var request models.MecHostInfo
	err = json.Unmarshal(c.Ctx.Input.RequestBody, &request)
	if err != nil {
		c.writeErrorResponse(util.FailedToUnmarshal, util.BadRequest)
		return
	}
	err = c.ValidateAddMecHostRequest(clientIp, request)
	if err != nil {
		c.writeErrorResponse("failed to add mec host request", util.BadRequest)
		return
	}
	userName, key, err := c.CheckUserNameAndKey(clientIp)
	if err != nil {
		return
	}
	if userName != "" && key != "" {
		err = c.validateCredentials(clientIp, userName, key)
		if err != nil {
			return
		}
	}
	err = c.InsertorUpdateMecHostRecord(clientIp, request)
	if err != nil {
		c.writeErrorResponse("failed to insert or update mec host record", util.BadRequest)
		return
	}
	c.handleLoggingForSuccess(clientIp, "Add or update mec host is successful")
	c.ServeJSON()
}