diff --git a/api/api.go b/api/api.go index a4d4be16..30ba1a24 100644 --- a/api/api.go +++ b/api/api.go @@ -1,8 +1,18 @@ // Package api provides implementation of aptly REST API package api +import ( + "github.com/gin-gonic/gin" + "github.com/smira/aptly/aptly" +) + // Lock order acquisition (canonical): // 1. RemoteRepoCollection // 2. LocalRepoCollection // 3. SnapshotCollection // 4. PublishedRepoCollection + +// GET /api/version +func apiVersion(c *gin.Context) { + c.JSON(200, gin.H{"Version": aptly.Version}) +} diff --git a/api/router.go b/api/router.go index 3e5b5efd..a34bdd10 100644 --- a/api/router.go +++ b/api/router.go @@ -16,6 +16,11 @@ func Router(c *ctx.AptlyContext) http.Handler { router.Use(gin.ErrorLogger()) root := router.Group("/api") + + { + root.GET("/version", apiVersion) + } + { root.GET("/repos", apiReposList) root.POST("/repos", apiReposCreate) diff --git a/system/t12_api/__init__.py b/system/t12_api/__init__.py index 9642eebe..b09d27a0 100644 --- a/system/t12_api/__init__.py +++ b/system/t12_api/__init__.py @@ -5,3 +5,4 @@ Testing aptly REST API from .repos import * from .files import * from .publish import * +from .version import * \ No newline at end of file