Browse Source

Add api/registry/.meta endpoint

master
Simon Marsh 1 year ago
parent
commit
cdba1d94f7
Signed by: burble <[email protected]> GPG Key ID: 7B9FE8780CFB6593
2 changed files with 37 additions and 0 deletions
  1. +17
    -0
      API.md
  2. +20
    -0
      regapi.go

+ 17
- 0
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


+ 20
- 0
regapi.go 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



Loading…
Cancel
Save