mirror of
https://github.com/dalbodeule/sh0rt.kr-pdns.git
synced 2025-06-08 18:58:20 +00:00
fix pdns api clients (retry 20x)
This commit is contained in:
parent
25650b2c16
commit
d423075da8
@ -20,18 +20,14 @@ class PowerDNSAPIClient() {
|
|||||||
@Value("\${pdns.api.key}")
|
@Value("\${pdns.api.key}")
|
||||||
private lateinit var apiKey: String
|
private lateinit var apiKey: String
|
||||||
|
|
||||||
@Value("\${pdns.ns}")
|
|
||||||
private lateinit var nameserver: String
|
|
||||||
|
|
||||||
private val gson = Gson()
|
private val gson = Gson()
|
||||||
private val client = OkHttpClient()
|
private val client = OkHttpClient()
|
||||||
|
|
||||||
@Throws(PowerDNSAPIException::class)
|
@Throws(PowerDNSAPIException::class)
|
||||||
fun createZone(zoneName: String): Response {
|
fun createZone(zoneName: String): Response {
|
||||||
val body = gson.toJson(mapOf(
|
val body = gson.toJson(mapOf(
|
||||||
"name" to "$zoneName.",
|
"name" to "$zoneName."
|
||||||
"nameservers" to nameserver.split(","))
|
)).toRequestBody()
|
||||||
).toRequestBody()
|
|
||||||
val request = Request.Builder()
|
val request = Request.Builder()
|
||||||
.url("$apiUrl/api/v1/servers/localhost/zones")
|
.url("$apiUrl/api/v1/servers/localhost/zones")
|
||||||
.addHeader("X-API-Key", apiKey)
|
.addHeader("X-API-Key", apiKey)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user