summaryrefslogtreecommitdiffstats
path: root/lib/apiv1
diff options
context:
space:
mode:
Diffstat (limited to 'lib/apiv1')
-rw-r--r--lib/apiv1/agent.go37
-rw-r--r--lib/apiv1/apiv1.go1
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/apiv1/agent.go b/lib/apiv1/agent.go
new file mode 100644
index 0000000..7434545
--- /dev/null
+++ b/lib/apiv1/agent.go
@@ -0,0 +1,37 @@
+package apiv1
+
+import (
+ "net/http"
+
+ "path/filepath"
+
+ "github.com/gin-gonic/gin"
+)
+
+type XDSAgentTarball struct {
+ OS string `json:"os"`
+ FileURL string `json:"fileUrl"`
+}
+type XDSAgentInfo struct {
+ Tarballs []XDSAgentTarball `json:"tarballs"`
+}
+
+// getXdsAgentInfo : return various information about Xds Agent
+func (s *APIService) getXdsAgentInfo(c *gin.Context) {
+ // TODO: retrieve link dynamically by reading assets/xds-agent-tarballs
+ tarballDir := "assets/xds-agent-tarballs"
+ response := XDSAgentInfo{
+ Tarballs: []XDSAgentTarball{
+ XDSAgentTarball{
+ OS: "linux",
+ FileURL: filepath.Join(tarballDir, "xds-agent_linux-amd64-v0.0.1_3cdf92c.zip"),
+ },
+ XDSAgentTarball{
+ OS: "windows",
+ FileURL: filepath.Join(tarballDir, "xds-agent_windows-386-v0.0.1_3cdf92c.zip"),
+ },
+ },
+ }
+
+ c.JSON(http.StatusOK, response)
+}
diff --git a/lib/apiv1/apiv1.go b/lib/apiv1/apiv1.go
index 7359266..2df8ea7 100644
--- a/lib/apiv1/apiv1.go
+++ b/lib/apiv1/apiv1.go
@@ -34,6 +34,7 @@ func New(r *gin.Engine, sess *session.Sessions, cfg *xdsconfig.Config, mfolder *
}
s.apiRouter.GET("/version", s.getVersion)
+ s.apiRouter.GET("/xdsagent/info", s.getXdsAgentInfo)
s.apiRouter.GET("/config", s.getConfig)
s.apiRouter.POST("/config", s.setConfig)