fix pdns api clients (retry 20x)

This commit is contained in:
dalbodeule 2024-06-07 15:46:30 +09:00
parent 25650b2c16
commit d423075da8
No known key found for this signature in database
GPG Key ID: EFA860D069C9FA65

View File

@ -20,18 +20,14 @@ class PowerDNSAPIClient() {
@Value("\${pdns.api.key}")
private lateinit var apiKey: String
@Value("\${pdns.ns}")
private lateinit var nameserver: String
private val gson = Gson()
private val client = OkHttpClient()
@Throws(PowerDNSAPIException::class)
fun createZone(zoneName: String): Response {
val body = gson.toJson(mapOf(
"name" to "$zoneName.",
"nameservers" to nameserver.split(","))
).toRequestBody()
"name" to "$zoneName."
)).toRequestBody()
val request = Request.Builder()
.url("$apiUrl/api/v1/servers/localhost/zones")
.addHeader("X-API-Key", apiKey)