use of org.nhind.config.DnsRecord in project nhin-d by DirectProject.
the class DNSRecordCommands method ensureSOA.
/**
* Adds an SOA records to the configuration service only if the record does not exist.
* @param args Contains the SOA record attributes.
*
* @since 1.0
*/
@Command(name = "Dns_SOA_Ensure", usage = ENSURE_SOA_USAGE)
public void ensureSOA(String[] args) {
DnsRecord record = fromRecord(parser.parseSOA(args));
if (!verifyIsUnique(record, false)) {
return;
}
addDNS(record);
}
use of org.nhind.config.DnsRecord in project nhin-d by DirectProject.
the class DNSRecordCommands method match.
/**
* Looks up all records for a given domain and any sub domains.
* @param args The first entry in the array contains the domain name (required).
*
* @since 1.0
*/
@Command(name = "Dns_Match", usage = "Resolve all records for the given domain")
public void match(String[] args) {
String domain = StringArrayUtil.getRequiredValue(args, 0);
DnsRecord[] records = null;
Pattern pattern = Pattern.compile(domain);
ArrayList<DnsRecord> matchedRecords = new ArrayList<DnsRecord>();
try {
records = proxy.getDNSByType(Type.ANY);
} catch (Exception e) {
throw new RuntimeException("Error accessing configuration service: " + e.getMessage(), e);
}
if (records == null || records.length == 0) {
System.out.println("No records found");
return;
} else {
for (DnsRecord record : records) {
Matcher matcher = pattern.matcher(record.getName());
if (matcher.find()) {
matchedRecords.add(record);
}
}
}
if (matchedRecords.size() == 0) {
System.out.println("No records found");
return;
}
print(matchedRecords.toArray(new DnsRecord[matchedRecords.size()]));
}
use of org.nhind.config.DnsRecord in project nhin-d by DirectProject.
the class DNSRecordCommands method ensureMX.
/**
* Adds an MX records to the configuration service only if the record does not exist.
* @param args Contains the MX record attributes.
*
* @since 1.0
*/
@Command(name = "Dns_MX_Ensure", usage = ENSURE_MX_USAGE)
public void ensureMX(String[] args) {
DnsRecord record = fromRecord(parser.parseMX(args));
if (!verifyIsUnique(record, false)) {
return;
}
addDNS(record);
}
use of org.nhind.config.DnsRecord in project nhin-d by DirectProject.
the class DNSRecordCommands method addANAME.
/**
* Adds an A records to the configuration service.
* @param args Contains the A record attributes.
*
* @since 1.0
*/
@Command(name = "Dns_ANAME_Add", usage = ADD_ANAME_USAGE)
public void addANAME(String[] args) {
DnsRecord record = fromRecord(parser.parseANAME(args));
addDNS(record);
}
use of org.nhind.config.DnsRecord in project nhin-d by DirectProject.
the class DNSRecordCommands method addSOA.
/**
* Adds an SOA records to the configuration service.
* @param args Contains the SOA record attributes.
*
* @since 1.0
*/
@Command(name = "Dns_SOA_Add", usage = ADD_SOA_USAGE)
public void addSOA(String[] args) {
DnsRecord record = fromRecord(parser.parseSOA(args));
addDNS(record);
}
Aggregations