summaryrefslogtreecommitdiffstats
path: root/lib/apiv1/agent.go
blob: 74345450a5de8d386d46465ecbdb09d55a6dc9b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)
}