Add dns reset to API (#1428)

This commit is contained in:
Pascal Vizeli 2020-01-09 22:27:39 +01:00 committed by GitHub
parent 36ae0c82b6
commit 36b9a609bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

2
API.md
View File

@ -797,6 +797,8 @@ return:
- POST `/dns/restart`
- POST `/dns/reset`
- GET `/dns/logs`
- GET `/dns/stats`

View File

@ -284,6 +284,7 @@ class RestAPI(CoreSysAttributes):
web.post("/dns/update", api_dns.update),
web.post("/dns/options", api_dns.options),
web.post("/dns/restart", api_dns.restart),
web.post("/dns/reset", api_dns.reset),
]
)

View File

@ -95,3 +95,8 @@ class APICoreDNS(CoreSysAttributes):
def restart(self, request: web.Request) -> Awaitable[None]:
"""Restart CoreDNS plugin."""
return asyncio.shield(self.sys_dns.restart())
@api_process
def reset(self, request: web.Request) -> Awaitable[None]:
"""Reset CoreDNS plugin."""
return asyncio.shield(self.sys_dns.reset())