diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-05-22 18:45:46 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-05-22 18:47:23 +0200 |
commit | 61ca475685c6b7b33654edaad637c7d53bdf8d34 (patch) | |
tree | b8996212810a58d1340b01b62ece8e99756c7dc1 /lib/apiv1/agent.go | |
parent | ad8f8d97a48f155ba94d5646012e969845a315ab (diff) |
Add XDS-agent tarball download feature
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/apiv1/agent.go')
-rw-r--r-- | lib/apiv1/agent.go | 37 |
1 files changed, 37 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) +} |