1
mirror of https://git.burble.com/burble.dn42/dn42regsrv.git synced 2024-02-26 20:28:04 +01:00

Add api/registry/.meta endpoint

This commit is contained in:
Simon Marsh 2019-05-26 19:59:30 +01:00
parent b9de311c36
commit cdba1d94f7
No known key found for this signature in database
GPG Key ID: 7B9FE8780CFB6593
2 changed files with 37 additions and 0 deletions

17
API.md
View File

@ -383,6 +383,23 @@ wget -O - -q http://localhost:8042/api/registry/aut-num/*/*-c/*burble?raw | jq
}
```
A special query exists to return metadata about the registry
```
GET /api/registry/.meta
```
Example Output (JSON format):
```
wget -O - -q http://localhost:8042/api/dns/.meta | jq
```
```
{
"Commit": "fa89d022d0c2a48bcfbee405e2f3685f3b9cf063"
}
```
## DNS Root Zone API
The DNS API provides a list of resource records that can be used to create a root zone for DN42

View File

@ -15,6 +15,13 @@ import (
// "time"
)
//////////////////////////////////////////////////////////////////////////
// data structures
type RegMetaReturn struct {
Commit string
}
//////////////////////////////////////////////////////////////////////////
// register the api
@ -38,6 +45,7 @@ func InitRegistryAPI(params ...interface{}) {
//s.HandleFunc("/.schema", rTypeListHandler)
//s.HandleFunc("/.meta/", rTypeListHandler)
s.HandleFunc("/.meta", regMetaHandler)
s.HandleFunc("/{type}", regTypeHandler)
s.HandleFunc("/{type}/{object}", regObjectHandler)
s.HandleFunc("/{type}/{object}/{key}", regKeyHandler)
@ -46,6 +54,18 @@ func InitRegistryAPI(params ...interface{}) {
log.Info("Registry API installed")
}
//////////////////////////////////////////////////////////////////////////
// return registry metadata
func regMetaHandler(w http.ResponseWriter, r *http.Request) {
rv := RegMetaReturn{
Commit: RegistryData.Commit,
}
ResponseJSON(w, rv)
}
//////////////////////////////////////////////////////////////////////////
// filter functions