|
@@ -32,6 +32,7 @@ import static org.cobbzilla.util.http.HttpMethods.PATCH; |
|
|
import static org.cobbzilla.util.http.HttpMethods.PUT; |
|
|
import static org.cobbzilla.util.http.HttpMethods.PUT; |
|
|
import static org.cobbzilla.util.json.JsonUtil.COMPACT_MAPPER; |
|
|
import static org.cobbzilla.util.json.JsonUtil.COMPACT_MAPPER; |
|
|
import static org.cobbzilla.util.json.JsonUtil.json; |
|
|
import static org.cobbzilla.util.json.JsonUtil.json; |
|
|
|
|
|
import static org.cobbzilla.wizard.resources.ResourceUtil.invalidEx; |
|
|
|
|
|
|
|
|
public class GoDaddyDnsDriver extends DnsDriverBase<GoDaddyDnsConfig> { |
|
|
public class GoDaddyDnsDriver extends DnsDriverBase<GoDaddyDnsConfig> { |
|
|
|
|
|
|
|
@@ -165,18 +166,21 @@ public class GoDaddyDnsDriver extends DnsDriverBase<GoDaddyDnsConfig> { |
|
|
if (domain == null) return emptyList(); |
|
|
if (domain == null) return emptyList(); |
|
|
|
|
|
|
|
|
// iterate over all records, return matches |
|
|
// iterate over all records, return matches |
|
|
String url = config.getBaseUri()+domain.getName()+"/records"; |
|
|
|
|
|
if (matcher != null) { |
|
|
|
|
|
if (matcher.hasType()) { |
|
|
|
|
|
url += "/" + matcher.getType().name(); |
|
|
|
|
|
} |
|
|
|
|
|
if (matcher.hasFqdn()) { |
|
|
|
|
|
String fqdn = matcher.getFqdn(); |
|
|
|
|
|
fqdn = domain.dropDomainSuffix(fqdn); |
|
|
|
|
|
url += "/" + fqdn; |
|
|
|
|
|
|
|
|
final var url = new StringBuilder(config.getBaseUri()).append(domain.getName()).append("/records"); |
|
|
|
|
|
if (matcher != null && (matcher.hasType() || matcher.hasFqdn())) { |
|
|
|
|
|
if (!matcher.hasType() || !matcher.hasPattern()) { |
|
|
|
|
|
// as per GoDaddy's docs both type and fqdn must be set here |
|
|
|
|
|
// https://developer.godaddy.com/doc/endpoint/domains#/v1/recordGet |
|
|
|
|
|
throw invalidEx("err.request.invalid", "Both type and pattern are required"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
url.append("/").append(matcher.getType().name()); |
|
|
|
|
|
|
|
|
|
|
|
var fqdn = matcher.getPattern(); |
|
|
|
|
|
fqdn = domain.dropDomainSuffix(fqdn); |
|
|
|
|
|
url.append("/").append(fqdn); |
|
|
} |
|
|
} |
|
|
return readRecords(domain, url, matcher); |
|
|
|
|
|
|
|
|
return readRecords(domain, url.toString(), matcher); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public Collection<DnsRecord> readRecords(BubbleDomain domain, String url, DnsRecordMatch matcher) { |
|
|
public Collection<DnsRecord> readRecords(BubbleDomain domain, String url, DnsRecordMatch matcher) { |
|
|