2021-05-09 13:06:06 +01:00
|
|
|
package instance
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
2021-05-15 10:58:11 +01:00
|
|
|
// InstanceInformationGETHandler is for serving instance information at /api/v1/instance
|
2021-05-09 13:06:06 +01:00
|
|
|
func (m *Module) InstanceInformationGETHandler(c *gin.Context) {
|
|
|
|
l := m.log.WithField("func", "InstanceInformationGETHandler")
|
|
|
|
|
|
|
|
instance, err := m.processor.InstanceGet(m.config.Host)
|
|
|
|
if err != nil {
|
|
|
|
l.Debugf("error getting instance from processor: %s", err)
|
|
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
c.JSON(http.StatusOK, instance)
|
|
|
|
}
|