Link api endpoints and http handlers to their modules
This commit is contained in:
@@ -11,6 +11,7 @@ func registerAPI() error {
|
||||
if err := api.RegisterEndpoint(api.Endpoint{
|
||||
Path: "dns/clear",
|
||||
Write: api.PermitUser,
|
||||
BelongsTo: module,
|
||||
ActionFunc: clearNameCache,
|
||||
Name: "Clear cached DNS records",
|
||||
Description: "Deletes all saved DNS records from the database.",
|
||||
@@ -21,6 +22,7 @@ func registerAPI() error {
|
||||
if err := api.RegisterEndpoint(api.Endpoint{
|
||||
Path: "dns/resolvers",
|
||||
Read: api.PermitAnyone,
|
||||
BelongsTo: module,
|
||||
StructFunc: exportDNSResolvers,
|
||||
Name: "List DNS Resolvers",
|
||||
Description: "List currently configured DNS resolvers and their status.",
|
||||
@@ -29,8 +31,9 @@ func registerAPI() error {
|
||||
}
|
||||
|
||||
if err := api.RegisterEndpoint(api.Endpoint{
|
||||
Path: `dns/cache/{query:[a-z0-9\.-]{0,512}\.[A-Z]{1,32}}`,
|
||||
Read: api.PermitUser,
|
||||
Path: `dns/cache/{query:[a-z0-9\.-]{0,512}\.[A-Z]{1,32}}`,
|
||||
Read: api.PermitUser,
|
||||
BelongsTo: module,
|
||||
RecordFunc: func(r *api.Request) (record.Record, error) {
|
||||
return recordDatabase.Get(nameRecordsKeyPrefix + r.URLVars["query"])
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user