From 3363e0ebdd2ad8bde458037b82432bc3dd93adde Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 9 May 2021 14:06:06 +0200 Subject: add api/v1/instance info handler + instance model (#18) --- internal/api/client/instance/instanceget.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 internal/api/client/instance/instanceget.go (limited to 'internal/api/client/instance/instanceget.go') diff --git a/internal/api/client/instance/instanceget.go b/internal/api/client/instance/instanceget.go new file mode 100644 index 000000000..f8e82c096 --- /dev/null +++ b/internal/api/client/instance/instanceget.go @@ -0,0 +1,20 @@ +package instance + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +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) +} -- cgit v1.2.3