use of com.microsoft.azure.management.dns.TxtRecord in project azure-sdk-for-java by Azure.
the class Utils method print.
/**
* Print a dns zone.
* @param dnsZone a dns zone
*/
public static void print(DnsZone dnsZone) {
StringBuilder info = new StringBuilder();
info.append("DNS Zone: ").append(dnsZone.id()).append("\n\tName (Top level domain): ").append(dnsZone.name()).append("\n\tResource group: ").append(dnsZone.resourceGroupName()).append("\n\tRegion: ").append(dnsZone.regionName()).append("\n\tTags: ").append(dnsZone.tags()).append("\n\tName servers:");
for (String nameServer : dnsZone.nameServers()) {
info.append("\n\t\t").append(nameServer);
}
SoaRecordSet soaRecordSet = dnsZone.getSoaRecordSet();
SoaRecord soaRecord = soaRecordSet.record();
info.append("\n\tSOA Record:").append("\n\t\tHost:").append(soaRecord.host()).append("\n\t\tEmail:").append(soaRecord.email()).append("\n\t\tExpire time (seconds):").append(soaRecord.expireTime()).append("\n\t\tRefresh time (seconds):").append(soaRecord.refreshTime()).append("\n\t\tRetry time (seconds):").append(soaRecord.retryTime()).append("\n\t\tNegative response cache ttl (seconds):").append(soaRecord.minimumTtl()).append("\n\t\tTTL (seconds):").append(soaRecordSet.timeToLive());
PagedList<ARecordSet> aRecordSets = dnsZone.aRecordSets().list();
info.append("\n\tA Record sets:");
for (ARecordSet aRecordSet : aRecordSets) {
info.append("\n\t\tId: ").append(aRecordSet.id()).append("\n\t\tName: ").append(aRecordSet.name()).append("\n\t\tTTL (seconds): ").append(aRecordSet.timeToLive()).append("\n\t\tIP v4 addresses: ");
for (String ipAddress : aRecordSet.ipv4Addresses()) {
info.append("\n\t\t\t").append(ipAddress);
}
}
PagedList<AaaaRecordSet> aaaaRecordSets = dnsZone.aaaaRecordSets().list();
info.append("\n\tAAAA Record sets:");
for (AaaaRecordSet aaaaRecordSet : aaaaRecordSets) {
info.append("\n\t\tId: ").append(aaaaRecordSet.id()).append("\n\t\tName: ").append(aaaaRecordSet.name()).append("\n\t\tTTL (seconds): ").append(aaaaRecordSet.timeToLive()).append("\n\t\tIP v6 addresses: ");
for (String ipAddress : aaaaRecordSet.ipv6Addresses()) {
info.append("\n\t\t\t").append(ipAddress);
}
}
PagedList<CNameRecordSet> cnameRecordSets = dnsZone.cNameRecordSets().list();
info.append("\n\tCNAME Record sets:");
for (CNameRecordSet cnameRecordSet : cnameRecordSets) {
info.append("\n\t\tId: ").append(cnameRecordSet.id()).append("\n\t\tName: ").append(cnameRecordSet.name()).append("\n\t\tTTL (seconds): ").append(cnameRecordSet.timeToLive()).append("\n\t\tCanonical name: ").append(cnameRecordSet.canonicalName());
}
PagedList<MXRecordSet> mxRecordSets = dnsZone.mxRecordSets().list();
info.append("\n\tMX Record sets:");
for (MXRecordSet mxRecordSet : mxRecordSets) {
info.append("\n\t\tId: ").append(mxRecordSet.id()).append("\n\t\tName: ").append(mxRecordSet.name()).append("\n\t\tTTL (seconds): ").append(mxRecordSet.timeToLive()).append("\n\t\tRecords: ");
for (MxRecord mxRecord : mxRecordSet.records()) {
info.append("\n\t\t\tExchange server, Preference: ").append(mxRecord.exchange()).append(" ").append(mxRecord.preference());
}
}
PagedList<NSRecordSet> nsRecordSets = dnsZone.nsRecordSets().list();
info.append("\n\tNS Record sets:");
for (NSRecordSet nsRecordSet : nsRecordSets) {
info.append("\n\t\tId: ").append(nsRecordSet.id()).append("\n\t\tName: ").append(nsRecordSet.name()).append("\n\t\tTTL (seconds): ").append(nsRecordSet.timeToLive()).append("\n\t\tName servers: ");
for (String nameServer : nsRecordSet.nameServers()) {
info.append("\n\t\t\t").append(nameServer);
}
}
PagedList<PtrRecordSet> ptrRecordSets = dnsZone.ptrRecordSets().list();
info.append("\n\tPTR Record sets:");
for (PtrRecordSet ptrRecordSet : ptrRecordSets) {
info.append("\n\t\tId: ").append(ptrRecordSet.id()).append("\n\t\tName: ").append(ptrRecordSet.name()).append("\n\t\tTTL (seconds): ").append(ptrRecordSet.timeToLive()).append("\n\t\tTarget domain names: ");
for (String domainNames : ptrRecordSet.targetDomainNames()) {
info.append("\n\t\t\t").append(domainNames);
}
}
PagedList<SrvRecordSet> srvRecordSets = dnsZone.srvRecordSets().list();
info.append("\n\tSRV Record sets:");
for (SrvRecordSet srvRecordSet : srvRecordSets) {
info.append("\n\t\tId: ").append(srvRecordSet.id()).append("\n\t\tName: ").append(srvRecordSet.name()).append("\n\t\tTTL (seconds): ").append(srvRecordSet.timeToLive()).append("\n\t\tRecords: ");
for (SrvRecord srvRecord : srvRecordSet.records()) {
info.append("\n\t\t\tTarget, Port, Priority, Weight: ").append(srvRecord.target()).append(", ").append(srvRecord.port()).append(", ").append(srvRecord.priority()).append(", ").append(srvRecord.weight());
}
}
PagedList<TxtRecordSet> txtRecordSets = dnsZone.txtRecordSets().list();
info.append("\n\tTXT Record sets:");
for (TxtRecordSet txtRecordSet : txtRecordSets) {
info.append("\n\t\tId: ").append(txtRecordSet.id()).append("\n\t\tName: ").append(txtRecordSet.name()).append("\n\t\tTTL (seconds): ").append(txtRecordSet.timeToLive()).append("\n\t\tRecords: ");
for (TxtRecord txtRecord : txtRecordSet.records()) {
if (txtRecord.value().size() > 0) {
info.append("\n\t\t\tValue: ").append(txtRecord.value().get(0));
}
}
}
System.out.println(info.toString());
}
use of com.microsoft.azure.management.dns.TxtRecord in project azure-sdk-for-java by Azure.
the class TestDns method print.
@Override
public void print(DnsZone dnsZone) {
StringBuilder info = new StringBuilder();
info.append("Dns Zone: ").append(dnsZone.id()).append("\n\tName (Top level domain): ").append(dnsZone.name()).append("\n\tResource group: ").append(dnsZone.resourceGroupName()).append("\n\tRegion: ").append(dnsZone.regionName()).append("\n\tTags: ").append(dnsZone.tags()).append("\n\tName servers:");
for (String nameServer : dnsZone.nameServers()) {
info.append("\n\t\t").append(nameServer);
}
SoaRecordSet soaRecordSet = dnsZone.getSoaRecordSet();
SoaRecord soaRecord = soaRecordSet.record();
info.append("\n\tSOA Record:").append("\n\t\tHost:").append(soaRecord.host()).append("\n\t\tEmail:").append(soaRecord.email()).append("\n\t\tExpire time (seconds):").append(soaRecord.expireTime()).append("\n\t\tRefresh time (seconds):").append(soaRecord.refreshTime()).append("\n\t\tRetry time (seconds):").append(soaRecord.retryTime()).append("\n\t\tNegative response cache ttl (seconds):").append(soaRecord.minimumTtl()).append("\n\t\tTTL (seconds):").append(soaRecordSet.timeToLive());
PagedList<ARecordSet> aRecordSets = dnsZone.aRecordSets().list();
info.append("\n\tA Record sets:");
for (ARecordSet aRecordSet : aRecordSets) {
info.append("\n\t\tId: ").append(aRecordSet.id()).append("\n\t\tName: ").append(aRecordSet.name()).append("\n\t\tTTL (seconds): ").append(aRecordSet.timeToLive()).append("\n\t\tIP v4 addresses: ");
for (String ipAddress : aRecordSet.ipv4Addresses()) {
info.append("\n\t\t\t").append(ipAddress);
}
}
PagedList<AaaaRecordSet> aaaaRecordSets = dnsZone.aaaaRecordSets().list();
info.append("\n\tAAAA Record sets:");
for (AaaaRecordSet aaaaRecordSet : aaaaRecordSets) {
info.append("\n\t\tId: ").append(aaaaRecordSet.id()).append("\n\t\tName: ").append(aaaaRecordSet.name()).append("\n\t\tTTL (seconds): ").append(aaaaRecordSet.timeToLive()).append("\n\t\tIP v6 addresses: ");
for (String ipAddress : aaaaRecordSet.ipv6Addresses()) {
info.append("\n\t\t\t").append(ipAddress);
}
}
PagedList<CNameRecordSet> cnameRecordSets = dnsZone.cNameRecordSets().list();
info.append("\n\tCNAME Record sets:");
for (CNameRecordSet cnameRecordSet : cnameRecordSets) {
info.append("\n\t\tId: ").append(cnameRecordSet.id()).append("\n\t\tName: ").append(cnameRecordSet.name()).append("\n\t\tTTL (seconds): ").append(cnameRecordSet.timeToLive()).append("\n\t\tCanonical name: ").append(cnameRecordSet.canonicalName());
}
PagedList<MXRecordSet> mxRecordSets = dnsZone.mxRecordSets().list();
info.append("\n\tMX Record sets:");
for (MXRecordSet mxRecordSet : mxRecordSets) {
info.append("\n\t\tId: ").append(mxRecordSet.id()).append("\n\t\tName: ").append(mxRecordSet.name()).append("\n\t\tTTL (seconds): ").append(mxRecordSet.timeToLive()).append("\n\t\tRecords: ");
for (MxRecord mxRecord : mxRecordSet.records()) {
info.append("\n\t\t\tExchange server, Preference: ").append(mxRecord.exchange()).append(" ").append(mxRecord.preference());
}
}
PagedList<NSRecordSet> nsRecordSets = dnsZone.nsRecordSets().list();
info.append("\n\tNS Record sets:");
for (NSRecordSet nsRecordSet : nsRecordSets) {
info.append("\n\t\tId: ").append(nsRecordSet.id()).append("\n\t\tName: ").append(nsRecordSet.name()).append("\n\t\tTTL (seconds): ").append(nsRecordSet.timeToLive()).append("\n\t\tName servers: ");
for (String nameServer : nsRecordSet.nameServers()) {
info.append("\n\t\t\t").append(nameServer);
}
}
PagedList<PtrRecordSet> ptrRecordSets = dnsZone.ptrRecordSets().list();
info.append("\n\tPTR Record sets:");
for (PtrRecordSet ptrRecordSet : ptrRecordSets) {
info.append("\n\t\tId: ").append(ptrRecordSet.id()).append("\n\t\tName: ").append(ptrRecordSet.name()).append("\n\t\tTTL (seconds): ").append(ptrRecordSet.timeToLive()).append("\n\t\tTarget domain names: ");
for (String domainNames : ptrRecordSet.targetDomainNames()) {
info.append("\n\t\t\t").append(domainNames);
}
}
PagedList<SrvRecordSet> srvRecordSets = dnsZone.srvRecordSets().list();
info.append("\n\tSRV Record sets:");
for (SrvRecordSet srvRecordSet : srvRecordSets) {
info.append("\n\t\tId: ").append(srvRecordSet.id()).append("\n\t\tName: ").append(srvRecordSet.name()).append("\n\t\tTTL (seconds): ").append(srvRecordSet.timeToLive()).append("\n\t\tRecords: ");
for (SrvRecord srvRecord : srvRecordSet.records()) {
info.append("\n\t\t\tTarget, Port, Priority, Weight: ").append(srvRecord.target()).append(", ").append(srvRecord.port()).append(", ").append(srvRecord.priority()).append(", ").append(srvRecord.weight());
}
}
PagedList<TxtRecordSet> txtRecordSets = dnsZone.txtRecordSets().list();
info.append("\n\tTXT Record sets:");
for (TxtRecordSet txtRecordSet : txtRecordSets) {
info.append("\n\t\tId: ").append(txtRecordSet.id()).append("\n\t\tName: ").append(txtRecordSet.name()).append("\n\t\tTTL (seconds): ").append(txtRecordSet.timeToLive()).append("\n\t\tRecords: ");
for (TxtRecord txtRecord : txtRecordSet.records()) {
if (txtRecord.value().size() > 0) {
info.append("\n\t\t\tValue: ").append(txtRecord.value().get(0));
}
}
}
System.out.println(info.toString());
}
use of com.microsoft.azure.management.dns.TxtRecord in project azure-sdk-for-java by Azure.
the class TxtRecordSetImpl method prepareForUpdate.
@Override
protected RecordSetInner prepareForUpdate(RecordSetInner resource) {
if (this.inner().txtRecords() != null && this.inner().txtRecords().size() > 0) {
if (resource.txtRecords() == null) {
resource.withTxtRecords(new ArrayList<TxtRecord>());
}
resource.txtRecords().addAll(this.inner().txtRecords());
this.inner().txtRecords().clear();
}
if (this.recordSetRemoveInfo.txtRecords().size() > 0) {
if (resource.txtRecords() != null) {
for (TxtRecord recordToRemove : this.recordSetRemoveInfo.txtRecords()) {
for (TxtRecord record : resource.txtRecords()) {
if (record.value().size() != 0 && record.value().get(0).equalsIgnoreCase(recordToRemove.value().get(0))) {
resource.txtRecords().remove(record);
break;
}
}
}
}
this.recordSetRemoveInfo.txtRecords().clear();
}
return resource;
}
Aggregations