Merge pull request #1541 from jclouds/cleanup-ultra

Cleanup ultra
This commit is contained in:
Adrian Cole 2013-04-16 11:49:15 -07:00
commit ae3cafdeef
57 changed files with 919 additions and 635 deletions

View File

@ -69,7 +69,7 @@ public interface UltraDNSWSApi extends Closeable {
@POST @POST
@XMLResponseParser(RegionListHandler.class) @XMLResponseParser(RegionListHandler.class)
@Payload("<v01:getAvailableRegions/>") @Payload("<v01:getAvailableRegions/>")
Multimap<IdAndName, String> getRegionsById(); Multimap<IdAndName, String> getRegionsByIdAndName();
/** /**
* Provides access to Zone features. * Provides access to Zone features.

View File

@ -43,7 +43,7 @@ public class UpdatePoolRecordToXML implements MapBinder {
UpdatePoolRecord update = UpdatePoolRecord.class.cast(postParams.get("update")); UpdatePoolRecord update = UpdatePoolRecord.class.cast(postParams.get("update"));
xml.append("<pointsTo>").append(update.getPointsTo()).append("</pointsTo>"); xml.append("<pointsTo>").append(update.getRData()).append("</pointsTo>");
xml.append("<priority>").append(update.getPriority()).append("</priority>"); xml.append("<priority>").append(update.getPriority()).append("</priority>");
xml.append("<failOverDelay>").append(update.getFailOverDelay()).append("</failOverDelay>"); xml.append("<failOverDelay>").append(update.getFailOverDelay()).append("</failOverDelay>");
xml.append("<ttl>").append(update.getTTL()).append("</ttl>"); xml.append("<ttl>").append(update.getTTL()).append("</ttl>");

View File

@ -134,6 +134,16 @@ public class DirectionalGroup extends ForwardingMultimap<String, String> {
return this; return this;
} }
/**
* adds to current regionToTerritories
*
* @see DirectionalGroup#getRegionToTerritories()
*/
public Builder mapRegion(String region) {
this.regionToTerritories.put(region, "all");
return this;
}
/** /**
* replaces current regionToTerritories * replaces current regionToTerritories
* *

View File

@ -44,23 +44,23 @@ public class DirectionalGroupCoordinates {
} }
/** /**
* the {@link DirectionalRecordDetail#getZoneName() name} of the zone. * the {@link DirectionalPoolRecordDetail#getZoneName() name} of the zone.
*/ */
public String getZoneName() { public String getZoneName() {
return zoneName; return zoneName;
} }
/** /**
* the {@link DirectionalRecordDetail#getName() dname} of the record. * the {@link DirectionalPoolRecordDetail#getName() dname} of the record.
*/ */
public String getRecordName() { public String getRecordName() {
return recordName; return recordName;
} }
/** /**
* the {@link DirectionalRecord#getType() recordType} of the record. * the {@link DirectionalPoolRecord#getType() recordType} of the record.
* *
* @see DirectionalRecordDetail#getRecord() * @see DirectionalPoolRecordDetail#getRecord()
*/ */
public int getRecordType() { public int getRecordType() {
return recordType; return recordType;
@ -69,9 +69,9 @@ public class DirectionalGroupCoordinates {
/** /**
* the {@link DirectionalGroup#getName() name} of the directional group. * the {@link DirectionalGroup#getName() name} of the directional group.
* *
* @see DirectionalRecordDetail#getGroup() * @see DirectionalPoolRecordDetail#getGroup()
* @see DirectionalRecordDetail#getGeolocationGroup() * @see DirectionalPoolRecordDetail#getGeolocationGroup()
* @see DirectionalRecordDetail#getSourceIpGroup() * @see DirectionalPoolRecordDetail#getSourceIpGroup()
*/ */
public String getGroupName() { public String getGroupName() {
return groupName; return groupName;

View File

@ -32,16 +32,16 @@ public final class DirectionalPool {
private final String zoneId; private final String zoneId;
private final String id; private final String id;
private final Optional<String> description; private final Optional<String> name;
private final String dname; private final String dname;
private final Type type; private final Type type;
private final TieBreak tieBreak; private final TieBreak tieBreak;
private DirectionalPool(String zoneId, String id, Optional<String> description, String dname, Type type, private DirectionalPool(String zoneId, String id, Optional<String> name, String dname, Type type,
TieBreak tieBreak) { TieBreak tieBreak) {
this.zoneId = checkNotNull(zoneId, "zoneId"); this.zoneId = checkNotNull(zoneId, "zoneId");
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
this.description = checkNotNull(description, "description for %s", id); this.name = checkNotNull(name, "name for %s", id);
this.dname = checkNotNull(dname, "dname for %s", id); this.dname = checkNotNull(dname, "dname for %s", id);
this.type = type; this.type = type;
this.tieBreak = tieBreak; this.tieBreak = tieBreak;
@ -58,15 +58,15 @@ public final class DirectionalPool {
/** /**
* The dname of the pool. ex. {@code jclouds.org.} * The dname of the pool. ex. {@code jclouds.org.}
*/ */
public String getName() { public String getDName() {
return dname; return dname;
} }
/** /**
* The description of the pool. ex. {@code My Pool} * The name of the pool. ex. {@code My Pool}
*/ */
public Optional<String> getDescription() { public Optional<String> getName() {
return description; return name;
} }
public Type getType() { public Type getType() {
@ -86,13 +86,66 @@ public final class DirectionalPool {
GEOLOCATION, SOURCEIP, MIXED; GEOLOCATION, SOURCEIP, MIXED;
} }
/**
* currently supported {@link ResourceRecord#getType() types} for directional
* groups.
*
*/
public static enum RecordType {
// A/CNAME
IPV4(1),
// AAAA/CNAME
IPV6(28),
TXT(16),
SRV(33),
PTR(12),
RP(17),
HINFO(13),
NAPTR(35),
MX(15);
@Override
public String toString() {
switch (this) {
case IPV4:
return "A";
case IPV6:
return "AAAA";
default:
return super.toString();
}
}
private final int code;
private RecordType(int code) {
this.code = code;
}
/**
* The {@link ResourceRecord#getType() type} that can be used in
* directional groups.
*/
public int getCode() {
return code;
}
}
public static enum TieBreak { public static enum TieBreak {
GEOLOCATION, SOURCEIP; GEOLOCATION, SOURCEIP;
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(zoneId, id, description, dname); return Objects.hashCode(zoneId, id, name, dname);
} }
@Override @Override
@ -105,13 +158,13 @@ public final class DirectionalPool {
return false; return false;
DirectionalPool that = DirectionalPool.class.cast(obj); DirectionalPool that = DirectionalPool.class.cast(obj);
return Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.id, that.id) return Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.id, that.id)
&& Objects.equal(this.description, that.description) && Objects.equal(this.dname, that.dname); && Objects.equal(this.name, that.name) && Objects.equal(this.dname, that.dname);
} }
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper(this).omitNullValues().add("zoneId", zoneId).add("id", id).add("name", dname) return Objects.toStringHelper(this).omitNullValues().add("zoneId", zoneId).add("id", id).add("dname", dname)
.add("description", description.orNull()).add("type", type).add("tieBreak", tieBreak).toString(); .add("name", name.orNull()).add("type", type).add("tieBreak", tieBreak).toString();
} }
public static Builder builder() { public static Builder builder() {
@ -125,7 +178,7 @@ public final class DirectionalPool {
public final static class Builder { public final static class Builder {
private String zoneId; private String zoneId;
private String id; private String id;
private Optional<String> description = Optional.absent(); private Optional<String> name = Optional.absent();
private String dname; private String dname;
private Type type = Type.GEOLOCATION; private Type type = Type.GEOLOCATION;
private TieBreak tieBreak = TieBreak.GEOLOCATION; private TieBreak tieBreak = TieBreak.GEOLOCATION;
@ -147,18 +200,18 @@ public final class DirectionalPool {
} }
/** /**
* @see DirectionalPool#getName() * @see DirectionalPool#getDName()
*/ */
public Builder name(String dname) { public Builder dname(String dname) {
this.dname = dname; this.dname = dname;
return this; return this;
} }
/** /**
* @see DirectionalPool#getDescription() * @see DirectionalPool#getName()
*/ */
public Builder description(String description) { public Builder name(String name) {
this.description = Optional.fromNullable(description); this.name = Optional.fromNullable(name);
return this; return this;
} }
@ -179,11 +232,11 @@ public final class DirectionalPool {
} }
public DirectionalPool build() { public DirectionalPool build() {
return new DirectionalPool(zoneId, id, description, dname, type, tieBreak); return new DirectionalPool(zoneId, id, name, dname, type, tieBreak);
} }
public Builder from(DirectionalPool in) { public Builder from(DirectionalPool in) {
return this.zoneId(in.zoneId).id(in.id).description(in.description.orNull()).name(in.dname).type(in.type) return this.zoneId(in.zoneId).id(in.id).name(in.name.orNull()).dname(in.dname).type(in.type)
.tieBreak(in.tieBreak); .tieBreak(in.tieBreak);
} }
} }

View File

@ -33,13 +33,13 @@ import com.google.common.collect.ImmutableList;
/** /**
* @author Adrian Cole * @author Adrian Cole
*/ */
public class DirectionalRecord { public class DirectionalPoolRecord {
private final String type; private final String type;
private final int ttl; private final int ttl;
private final boolean noResponseRecord; private final boolean noResponseRecord;
private final List<String> infoValues; private final List<String> infoValues;
private DirectionalRecord(String type, int ttl, boolean noResponseRecord, List<String> infoValues) { private DirectionalPoolRecord(String type, int ttl, boolean noResponseRecord, List<String> infoValues) {
this.type = checkNotNull(type, "type"); this.type = checkNotNull(type, "type");
checkArgument(ttl >= 0, "ttl must be >= 0"); checkArgument(ttl >= 0, "ttl must be >= 0");
this.ttl = ttl; this.ttl = ttl;
@ -84,7 +84,7 @@ public class DirectionalRecord {
return true; return true;
if (obj == null || getClass() != obj.getClass()) if (obj == null || getClass() != obj.getClass())
return false; return false;
DirectionalRecord that = DirectionalRecord.class.cast(obj); DirectionalPoolRecord that = DirectionalPoolRecord.class.cast(obj);
return equal(this.type, that.type) && equal(this.ttl, that.ttl) return equal(this.type, that.type) && equal(this.ttl, that.ttl)
&& equal(this.noResponseRecord, that.noResponseRecord) && equal(this.infoValues, that.infoValues); && equal(this.noResponseRecord, that.noResponseRecord) && equal(this.infoValues, that.infoValues);
} }
@ -110,7 +110,7 @@ public class DirectionalRecord {
private ImmutableList.Builder<String> infoValues = ImmutableList.<String> builder(); private ImmutableList.Builder<String> infoValues = ImmutableList.<String> builder();
/** /**
* @see DirectionalRecord#getType() * @see DirectionalPoolRecord#getType()
*/ */
public Builder type(String type) { public Builder type(String type) {
this.type = type; this.type = type;
@ -118,7 +118,7 @@ public class DirectionalRecord {
} }
/** /**
* @see DirectionalRecord#getTTL() * @see DirectionalPoolRecord#getTTL()
*/ */
public Builder ttl(int ttl) { public Builder ttl(int ttl) {
this.ttl = ttl; this.ttl = ttl;
@ -126,7 +126,7 @@ public class DirectionalRecord {
} }
/** /**
* @see DirectionalRecord#isNoResponseRecord() * @see DirectionalPoolRecord#isNoResponseRecord()
*/ */
public Builder noResponseRecord(boolean noResponseRecord) { public Builder noResponseRecord(boolean noResponseRecord) {
this.noResponseRecord = noResponseRecord; this.noResponseRecord = noResponseRecord;
@ -136,7 +136,7 @@ public class DirectionalRecord {
/** /**
* adds to current values * adds to current values
* *
* @see DirectionalRecord#getRData() * @see DirectionalPoolRecord#getRData()
*/ */
public Builder infoValue(Object infoValue) { public Builder infoValue(Object infoValue) {
this.infoValues.add(infoValue.toString()); this.infoValues.add(infoValue.toString());
@ -146,7 +146,7 @@ public class DirectionalRecord {
/** /**
* replaces current values * replaces current values
* *
* @see DirectionalRecord#getRData() * @see DirectionalPoolRecord#getRData()
*/ */
public Builder rdata(Object infoValue) { public Builder rdata(Object infoValue) {
this.infoValues = ImmutableList.<String> builder().add(infoValue.toString()); this.infoValues = ImmutableList.<String> builder().add(infoValue.toString());
@ -156,18 +156,18 @@ public class DirectionalRecord {
/** /**
* replaces current values * replaces current values
* *
* @see DirectionalRecord#getRData() * @see DirectionalPoolRecord#getRData()
*/ */
public Builder rdata(Iterable<?> infoValues) { public Builder rdata(Iterable<?> infoValues) {
this.infoValues = ImmutableList.<String> builder().addAll(transform(infoValues, toStringFunction())); this.infoValues = ImmutableList.<String> builder().addAll(transform(infoValues, toStringFunction()));
return this; return this;
} }
public DirectionalRecord build() { public DirectionalPoolRecord build() {
return new DirectionalRecord(type, ttl, noResponseRecord, infoValues.build()); return new DirectionalPoolRecord(type, ttl, noResponseRecord, infoValues.build());
} }
public Builder from(DirectionalRecord in) { public Builder from(DirectionalPoolRecord in) {
return type(in.type).ttl(in.ttl).noResponseRecord(in.noResponseRecord).rdata(in.infoValues); return type(in.type).ttl(in.ttl).noResponseRecord(in.noResponseRecord).rdata(in.infoValues);
} }
} }

View File

@ -28,7 +28,7 @@ import com.google.common.base.Optional;
/** /**
* @author Adrian Cole * @author Adrian Cole
*/ */
public class DirectionalRecordDetail { public class DirectionalPoolRecordDetail {
private final String zoneName; private final String zoneName;
private final String name; private final String name;
@ -36,11 +36,11 @@ public class DirectionalRecordDetail {
private final Optional<IdAndName> group; private final Optional<IdAndName> group;
private final Optional<IdAndName> geolocationGroup; private final Optional<IdAndName> geolocationGroup;
private final Optional<IdAndName> sourceIpGroup; private final Optional<IdAndName> sourceIpGroup;
private final DirectionalRecord record; private final DirectionalPoolRecord record;
private DirectionalRecordDetail(String zoneName, String name, String id, private DirectionalPoolRecordDetail(String zoneName, String name, String id,
Optional<IdAndName> group, Optional<IdAndName> geolocationGroup, Optional<IdAndName> group, Optional<IdAndName> geolocationGroup,
Optional<IdAndName> sourceIpGroup, DirectionalRecord record) { Optional<IdAndName> sourceIpGroup, DirectionalPoolRecord record) {
this.zoneName = checkNotNull(zoneName, "zoneName"); this.zoneName = checkNotNull(zoneName, "zoneName");
this.name = checkNotNull(name, "name"); this.name = checkNotNull(name, "name");
this.id = checkNotNull(id, "id"); this.id = checkNotNull(id, "id");
@ -83,7 +83,7 @@ public class DirectionalRecordDetail {
return sourceIpGroup; return sourceIpGroup;
} }
public DirectionalRecord getRecord() { public DirectionalPoolRecord getRecord() {
return record; return record;
} }
@ -98,7 +98,7 @@ public class DirectionalRecordDetail {
return true; return true;
if (obj == null || getClass() != obj.getClass()) if (obj == null || getClass() != obj.getClass())
return false; return false;
DirectionalRecordDetail that = DirectionalRecordDetail.class.cast(obj); DirectionalPoolRecordDetail that = DirectionalPoolRecordDetail.class.cast(obj);
return equal(this.zoneName, that.zoneName) && equal(this.name, that.name) && equal(this.id, that.id); return equal(this.zoneName, that.zoneName) && equal(this.name, that.name) && equal(this.id, that.id);
} }
@ -124,10 +124,10 @@ public class DirectionalRecordDetail {
private Optional<IdAndName> group = Optional.absent(); private Optional<IdAndName> group = Optional.absent();
private Optional<IdAndName> geolocationGroup = Optional.absent(); private Optional<IdAndName> geolocationGroup = Optional.absent();
private Optional<IdAndName> sourceIpGroup = Optional.absent(); private Optional<IdAndName> sourceIpGroup = Optional.absent();
private DirectionalRecord record; private DirectionalPoolRecord record;
/** /**
* @see DirectionalRecordDetail#getZoneName() * @see DirectionalPoolRecordDetail#getZoneName()
*/ */
public Builder zoneName(String zoneName) { public Builder zoneName(String zoneName) {
this.zoneName = zoneName; this.zoneName = zoneName;
@ -135,7 +135,7 @@ public class DirectionalRecordDetail {
} }
/** /**
* @see DirectionalRecordDetail#getName() * @see DirectionalPoolRecordDetail#getName()
*/ */
public Builder name(String name) { public Builder name(String name) {
this.name = name; this.name = name;
@ -143,7 +143,7 @@ public class DirectionalRecordDetail {
} }
/** /**
* @see DirectionalRecordDetail#getId() * @see DirectionalPoolRecordDetail#getId()
*/ */
public Builder id(String id) { public Builder id(String id) {
this.id = id; this.id = id;
@ -151,7 +151,7 @@ public class DirectionalRecordDetail {
} }
/** /**
* @see DirectionalRecordDetail#getGroup() * @see DirectionalPoolRecordDetail#getGroup()
*/ */
public Builder group(IdAndName group) { public Builder group(IdAndName group) {
this.group = Optional.fromNullable(group); this.group = Optional.fromNullable(group);
@ -159,7 +159,7 @@ public class DirectionalRecordDetail {
} }
/** /**
* @see DirectionalRecordDetail#getGeolocationGroup() * @see DirectionalPoolRecordDetail#getGeolocationGroup()
*/ */
public Builder geolocationGroup(IdAndName geolocationGroup) { public Builder geolocationGroup(IdAndName geolocationGroup) {
this.geolocationGroup = Optional.fromNullable(geolocationGroup); this.geolocationGroup = Optional.fromNullable(geolocationGroup);
@ -167,7 +167,7 @@ public class DirectionalRecordDetail {
} }
/** /**
* @see DirectionalRecordDetail#getSourceIpGroup() * @see DirectionalPoolRecordDetail#getSourceIpGroup()
*/ */
public Builder sourceIpGroup(IdAndName sourceIpGroup) { public Builder sourceIpGroup(IdAndName sourceIpGroup) {
this.sourceIpGroup = Optional.fromNullable(sourceIpGroup); this.sourceIpGroup = Optional.fromNullable(sourceIpGroup);
@ -175,26 +175,26 @@ public class DirectionalRecordDetail {
} }
/** /**
* @see DirectionalRecordDetail#getRecord() * @see DirectionalPoolRecordDetail#getRecord()
*/ */
public Builder record(DirectionalRecord record) { public Builder record(DirectionalPoolRecord record) {
this.record = record; this.record = record;
return this; return this;
} }
/** /**
* @see DirectionalRecordDetail#getRecord() * @see DirectionalPoolRecordDetail#getRecord()
*/ */
public Builder record(DirectionalRecord.Builder record) { public Builder record(DirectionalPoolRecord.Builder record) {
this.record = record.build(); this.record = record.build();
return this; return this;
} }
public DirectionalRecordDetail build() { public DirectionalPoolRecordDetail build() {
return new DirectionalRecordDetail(zoneName, name, id, group, geolocationGroup, sourceIpGroup, record); return new DirectionalPoolRecordDetail(zoneName, name, id, group, geolocationGroup, sourceIpGroup, record);
} }
public Builder from(DirectionalRecordDetail in) { public Builder from(DirectionalPoolRecordDetail in) {
return this.zoneName(in.zoneName).name(in.name).id(in.id).group(in.group.orNull()) return this.zoneName(in.zoneName).name(in.name).id(in.id).group(in.group.orNull())
.geolocationGroup(in.geolocationGroup.orNull()).sourceIpGroup(in.sourceIpGroup.orNull()) .geolocationGroup(in.geolocationGroup.orNull()).sourceIpGroup(in.sourceIpGroup.orNull())
.record(in.record); .record(in.record);

View File

@ -1,62 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.ultradns.ws.domain;
/**
* currently supported {@link ResourceRecord#getType() types} for directional
* groups.
*
* @author Adrian Cole
*/
public enum DirectionalRecordType {
// A/CNAME
IPV4(1),
// AAAA/CNAME
IPV6(28),
TXT(16),
SRV(33),
PTR(12),
RP(17),
HINFO(13),
NAPTR(35),
MX(15);
private final int code;
private DirectionalRecordType(int code) {
this.code = code;
}
/**
* The {@link ResourceRecord#getType() type} that can be used in directional
* groups.
*/
public int getCode() {
return code;
}
}

View File

@ -19,14 +19,19 @@
package org.jclouds.ultradns.ws.domain; package org.jclouds.ultradns.ws.domain;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.compose;
import static com.google.common.base.Predicates.equalTo;
import com.google.common.base.Function;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Predicate;
/** /**
* @author Adrian Cole * @author Adrian Cole
*/ */
public final class IdAndName { public final class IdAndName {
public static IdAndName fromIdAndName(String id, String name) {
public static IdAndName create(String id, String name) {
return new IdAndName(id, name); return new IdAndName(id, name);
} }
@ -71,6 +76,25 @@ public final class IdAndName {
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper(this).add("id", id).add("name", name).toString(); return Objects.toStringHelper("").add("id", id).add("name", name).toString();
}
/**
* convenience predicate as typically the user is unaware of the system
* generated id of a resource
*
* @param name
* see {@link #getName()}
*/
public static Predicate<IdAndName> nameEqualTo(String name) {
return compose(equalTo(name), ToName.INSTANCE);
}
private static enum ToName implements Function<IdAndName, String> {
INSTANCE;
@Override
public String apply(IdAndName input) {
return input.getName();
}
} }
} }

View File

@ -57,7 +57,7 @@ public final class PoolRecordSpec {
} }
/** /**
* correlates to {@link TrafficControllerPoolRecord#getDescription()} * correlates to {@link TrafficControllerPoolRecordDetail#getDescription()}
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
@ -71,7 +71,7 @@ public final class PoolRecordSpec {
} }
/** /**
* correlates to {@link TrafficControllerPoolRecord#isProbingEnabled()} * correlates to {@link TrafficControllerPoolRecordDetail#isProbingEnabled()}
*/ */
public boolean isProbingEnabled() { public boolean isProbingEnabled() {
return probingEnabled; return probingEnabled;
@ -85,7 +85,7 @@ public final class PoolRecordSpec {
} }
/** /**
* correlates to {@link TrafficControllerPoolRecord#getWeight()} * correlates to {@link TrafficControllerPoolRecordDetail#getWeight()}
*/ */
public int getWeight() { public int getWeight() {
return weight; return weight;

View File

@ -30,7 +30,7 @@ import com.google.common.base.Objects;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ResourceRecordMetadata { public class ResourceRecordDetail {
private final String zoneId; private final String zoneId;
private final String guid; private final String guid;
@ -39,7 +39,7 @@ public class ResourceRecordMetadata {
private final Date modified; private final Date modified;
private final ResourceRecord record; private final ResourceRecord record;
private ResourceRecordMetadata(String zoneId, String guid, String zoneName, Date created, Date modified, private ResourceRecordDetail(String zoneId, String guid, String zoneName, Date created, Date modified,
ResourceRecord record) { ResourceRecord record) {
this.zoneId = checkNotNull(zoneId, "zoneId"); this.zoneId = checkNotNull(zoneId, "zoneId");
this.guid = checkNotNull(guid, "guid"); this.guid = checkNotNull(guid, "guid");
@ -87,7 +87,7 @@ public class ResourceRecordMetadata {
return true; return true;
if (obj == null || getClass() != obj.getClass()) if (obj == null || getClass() != obj.getClass())
return false; return false;
ResourceRecordMetadata that = ResourceRecordMetadata.class.cast(obj); ResourceRecordDetail that = ResourceRecordDetail.class.cast(obj);
return equal(this.zoneId, that.zoneId) && equal(this.guid, that.guid); return equal(this.zoneId, that.zoneId) && equal(this.guid, that.guid);
} }
@ -114,7 +114,7 @@ public class ResourceRecordMetadata {
private ResourceRecord record; private ResourceRecord record;
/** /**
* @see ResourceRecordMetadata#getZoneName() * @see ResourceRecordDetail#getZoneName()
*/ */
public Builder zoneName(String zoneName) { public Builder zoneName(String zoneName) {
this.zoneName = zoneName; this.zoneName = zoneName;
@ -122,7 +122,7 @@ public class ResourceRecordMetadata {
} }
/** /**
* @see ResourceRecordMetadata#getGuid() * @see ResourceRecordDetail#getGuid()
*/ */
public Builder guid(String guid) { public Builder guid(String guid) {
this.guid = guid; this.guid = guid;
@ -130,7 +130,7 @@ public class ResourceRecordMetadata {
} }
/** /**
* @see ResourceRecordMetadata#getZoneId() * @see ResourceRecordDetail#getZoneId()
*/ */
public Builder zoneId(String zoneId) { public Builder zoneId(String zoneId) {
this.zoneId = zoneId; this.zoneId = zoneId;
@ -138,7 +138,7 @@ public class ResourceRecordMetadata {
} }
/** /**
* @see ResourceRecordMetadata#getCreated() * @see ResourceRecordDetail#getCreated()
*/ */
public Builder created(Date created) { public Builder created(Date created) {
this.created = created; this.created = created;
@ -146,7 +146,7 @@ public class ResourceRecordMetadata {
} }
/** /**
* @see ResourceRecordMetadata#getModified() * @see ResourceRecordDetail#getModified()
*/ */
public Builder modified(Date modified) { public Builder modified(Date modified) {
this.modified = modified; this.modified = modified;
@ -154,7 +154,7 @@ public class ResourceRecordMetadata {
} }
/** /**
* @see ResourceRecordMetadata#getRecord() * @see ResourceRecordDetail#getRecord()
*/ */
public Builder record(ResourceRecord record) { public Builder record(ResourceRecord record) {
this.record = record; this.record = record;
@ -162,18 +162,18 @@ public class ResourceRecordMetadata {
} }
/** /**
* @see ResourceRecordMetadata#getRecord() * @see ResourceRecordDetail#getRecord()
*/ */
public Builder record(ResourceRecord.Builder record) { public Builder record(ResourceRecord.Builder record) {
this.record = record.build(); this.record = record.build();
return this; return this;
} }
public ResourceRecordMetadata build() { public ResourceRecordDetail build() {
return new ResourceRecordMetadata(zoneId, guid, zoneName, created, modified, record); return new ResourceRecordDetail(zoneId, guid, zoneName, created, modified, record);
} }
public Builder from(ResourceRecordMetadata in) { public Builder from(ResourceRecordDetail in) {
return this.zoneName(in.zoneName).guid(in.guid).zoneId(in.zoneId).created(in.created).modified(in.modified) return this.zoneName(in.zoneName).guid(in.guid).zoneId(in.zoneId).created(in.created).modified(in.modified)
.record(in.record); .record(in.record);
} }

View File

@ -99,6 +99,30 @@ public final class TrafficControllerPool {
return probingEnabled; return probingEnabled;
} }
/**
* currently supported {@link ResourceRecord#getType() types} for traffic
* controller pools.
*
*/
public static enum RecordType {
// A/CNAME
IPV4(1),
// AAAA/CNAME
IPV6(28);
@Override
public String toString() {
return String.valueOf(code);
}
private final int code;
private RecordType(int code) {
this.code = code;
}
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(zoneId, id, name, dname); return Objects.hashCode(zoneId, id, name, dname);

View File

@ -18,82 +18,34 @@
*/ */
package org.jclouds.ultradns.ws.domain; package org.jclouds.ultradns.ws.domain;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects; import com.google.common.base.Objects;
/** /**
*
* @author Adrian Cole * @author Adrian Cole
*/ */
public final class TrafficControllerPoolRecord { public class TrafficControllerPoolRecord {
public static TrafficControllerPoolRecord createA(String rdata) {
return new TrafficControllerPoolRecord("A", rdata);
}
public static TrafficControllerPoolRecord createCNAME(String rdata) {
return new TrafficControllerPoolRecord("CNAME", rdata);
}
public static TrafficControllerPoolRecord create(String type, String rdata) {
return new TrafficControllerPoolRecord(type, rdata);
}
private final String id;
private final String poolId;
private final String pointsTo;
private final int weight;
private final int priority;
private final String type; private final String type;
private final String forceAnswer; private final String rdata;
private final boolean probingEnabled;
private final Status status;
private final boolean serving;
private final String description;
private TrafficControllerPoolRecord(String id, String poolId, String pointsTo, int weight, int priority, private TrafficControllerPoolRecord(String type, String rdata) {
String type, String forceAnswer, boolean probingEnabled, Status status, boolean serving, String description) { this.type = checkNotNull(type, "type");
this.id = checkNotNull(id, "id"); this.rdata = checkNotNull(rdata, "rdata");
this.poolId = checkNotNull(poolId, "poolId for %s", id);
this.pointsTo = checkNotNull(pointsTo, "pointsTo for %s", poolId);
checkArgument(weight >= 0, "weight of %s must be >= 0", id);
this.weight = weight;
checkArgument(priority >= 0, "priority of %s must be >= 0", id);
this.priority = priority;
this.type = checkNotNull(type, "type for %s", poolId);
this.forceAnswer = checkNotNull(forceAnswer, "forceAnswer for %s", poolId);
this.probingEnabled = probingEnabled;
this.status = checkNotNull(status, "status for %s", poolId);
this.serving = serving;
this.description = checkNotNull(description, "description for %s", description);
}
/**
* The ID of the zone.
*/
public String getId() {
return id;
}
/**
* The pool this record belongs to.
*/
public String getPoolId() {
return poolId;
}
/**
* address or cname this points to. ex. {@code jclouds.org.} or
* {@code 1.2.3.4}
*/
public String getPointsTo() {
return pointsTo;
}
/**
* 0 or even numbers from 2100. Determines the traffic load to send to each
* server in a Traffic Controller pool. The value 0 indicates that Traffic
* Controller always serves the record.
*/
public int getWeight() {
return weight;
}
/**
* the default value is 1. The value 0 is the special All Fail priority.
*/
public int getPriority() {
return priority;
} }
/** /**
@ -103,188 +55,31 @@ public final class TrafficControllerPoolRecord {
return type; return type;
} }
public String getForceAnswer() {
return forceAnswer;
}
public boolean isProbingEnabled() {
return probingEnabled;
}
/** /**
* status of the record * address or cname this points to. ex. {@code jclouds.org.} or
* {@code 1.2.3.4}
*/ */
public Status getStatus() { public String getRData() {
return status; return rdata;
}
public boolean isServing() {
return serving;
}
/**
* description of the record
*/
public String getDescription() {
return description;
}
public static enum Status {
OK, DISABLED, UNRECOGNIZED;
public static Status fromValue(String status) {
try {
return valueOf(checkNotNull(status, "status"));
} catch (IllegalArgumentException e) {
return UNRECOGNIZED;
}
}
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(id, poolId); return Objects.hashCode(type, rdata);
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
return true; return true;
if (obj == null) if (obj == null || getClass() != obj.getClass())
return false;
if (getClass() != obj.getClass())
return false; return false;
TrafficControllerPoolRecord that = TrafficControllerPoolRecord.class.cast(obj); TrafficControllerPoolRecord that = TrafficControllerPoolRecord.class.cast(obj);
return Objects.equal(this.id, that.id) && Objects.equal(this.poolId, that.poolId); return equal(this.type, that.type) && equal(this.rdata, that.rdata);
} }
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper(this).add("id", id).add("poolId", poolId).add("pointsTo", pointsTo) return toStringHelper(this).add("type", type).add("rdata", rdata).toString();
.add("weight", weight).add("priority", priority).add("type", type).add("forceAnswer", forceAnswer)
.add("probingEnabled", probingEnabled).add("status", status).add("serving", serving)
.add("description", description).toString();
}
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().from(this);
}
public final static class Builder {
private String id;
private String poolId;
private String pointsTo;
private int weight;
private int priority;
private String type;
private String forceAnswer;
private boolean probingEnabled;
private Status status;
private boolean serving;
private String description;
/**
* @see TrafficControllerPoolRecord#getId()
*/
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see TrafficControllerPoolRecord#getPoolId()
*/
public Builder poolId(String poolId) {
this.poolId = poolId;
return this;
}
/**
* @see TrafficControllerPoolRecord#getPointsTo()
*/
public Builder pointsTo(String pointsTo) {
this.pointsTo = pointsTo;
return this;
}
/**
* @see TrafficControllerPoolRecord#getWeight()
*/
public Builder weight(int weight) {
this.weight = weight;
return this;
}
/**
* @see TrafficControllerPoolRecord#getPriority()
*/
public Builder priority(int priority) {
this.priority = priority;
return this;
}
/**
* @see TrafficControllerPoolRecord#getType()
*/
public Builder type(String type) {
this.type = type;
return this;
}
/**
* @see TrafficControllerPoolRecord#getForceAnswer()
*/
public Builder forceAnswer(String forceAnswer) {
this.forceAnswer = forceAnswer;
return this;
}
/**
* @see TrafficControllerPoolRecord#isProbingEnabled()
*/
public Builder probingEnabled(boolean probingEnabled) {
this.probingEnabled = probingEnabled;
return this;
}
/**
* @see TrafficControllerPoolRecord#getStatus()
*/
public Builder status(Status status) {
this.status = status;
return this;
}
/**
* @see TrafficControllerPoolRecord#isServing()
*/
public Builder serving(boolean serving) {
this.serving = serving;
return this;
}
/**
* @see TrafficControllerPoolRecord#getDescription()
*/
public Builder description(String description) {
this.description = description;
return this;
}
public TrafficControllerPoolRecord build() {
return new TrafficControllerPoolRecord(id, poolId, pointsTo, weight, priority, type, forceAnswer,
probingEnabled, status, serving, description);
}
public Builder from(TrafficControllerPoolRecord in) {
return this.id(in.id).poolId(in.poolId).weight(in.weight).pointsTo(in.pointsTo).priority(in.priority)
.type(in.type).forceAnswer(in.forceAnswer).probingEnabled(in.probingEnabled).status(in.status)
.serving(in.serving).description(in.description);
}
} }
} }

View File

@ -0,0 +1,271 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.ultradns.ws.domain;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects;
/**
*
* @author Adrian Cole
*/
public final class TrafficControllerPoolRecordDetail {
private final String id;
private final String poolId;
private final TrafficControllerPoolRecord record;
private final int weight;
private final int priority;
private final String forceAnswer;
private final boolean probingEnabled;
private final Status status;
private final boolean serving;
private final String description;
private TrafficControllerPoolRecordDetail(String id, String poolId, TrafficControllerPoolRecord record, int weight,
int priority, String forceAnswer, boolean probingEnabled, Status status, boolean serving, String description) {
this.id = checkNotNull(id, "id");
this.poolId = checkNotNull(poolId, "poolId for %s", id);
this.record = checkNotNull(record, "record for %s", poolId);
checkArgument(weight >= 0, "weight of %s must be >= 0", id);
this.weight = weight;
checkArgument(priority >= 0, "priority of %s must be >= 0", id);
this.priority = priority;
this.forceAnswer = checkNotNull(forceAnswer, "forceAnswer for %s", poolId);
this.probingEnabled = probingEnabled;
this.status = checkNotNull(status, "status for %s", poolId);
this.serving = serving;
this.description = checkNotNull(description, "description for %s", description);
}
/**
* The ID of the zone.
*/
public String getId() {
return id;
}
/**
* The pool this record belongs to.
*/
public String getPoolId() {
return poolId;
}
/**
* the record pointed to
*/
public TrafficControllerPoolRecord getRecord() {
return record;
}
/**
* 0 or even numbers from 2100. Determines the traffic load to send to each
* server in a Traffic Controller pool. The value 0 indicates that Traffic
* Controller always serves the record.
*/
public int getWeight() {
return weight;
}
/**
* the default value is 1. The value 0 is the special All Fail priority.
*/
public int getPriority() {
return priority;
}
public String getForceAnswer() {
return forceAnswer;
}
public boolean isProbingEnabled() {
return probingEnabled;
}
/**
* status of the record
*/
public Status getStatus() {
return status;
}
public boolean isServing() {
return serving;
}
/**
* description of the record
*/
public String getDescription() {
return description;
}
public static enum Status {
OK, WARNING, CRITICAL, FAILURE, DISABLED, UNRECOGNIZED;
public static Status fromValue(String status) {
try {
return valueOf(checkNotNull(status, "status").toUpperCase());
} catch (IllegalArgumentException e) {
return UNRECOGNIZED;
}
}
}
@Override
public int hashCode() {
return Objects.hashCode(id, poolId);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TrafficControllerPoolRecordDetail that = TrafficControllerPoolRecordDetail.class.cast(obj);
return Objects.equal(this.id, that.id) && Objects.equal(this.poolId, that.poolId);
}
@Override
public String toString() {
return Objects.toStringHelper(this).add("id", id).add("poolId", poolId).add("record", record)
.add("weight", weight).add("priority", priority).add("forceAnswer", forceAnswer)
.add("probingEnabled", probingEnabled).add("status", status).add("serving", serving)
.add("description", description).toString();
}
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().from(this);
}
public final static class Builder {
private String id;
private String poolId;
private TrafficControllerPoolRecord record;
private int weight;
private int priority;
private String forceAnswer;
private boolean probingEnabled;
private Status status;
private boolean serving;
private String description;
/**
* @see TrafficControllerPoolRecordDetail#getId()
*/
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#getPoolId()
*/
public Builder poolId(String poolId) {
this.poolId = poolId;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#getRecord()
*/
public Builder record(TrafficControllerPoolRecord record) {
this.record = record;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#getWeight()
*/
public Builder weight(int weight) {
this.weight = weight;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#getPriority()
*/
public Builder priority(int priority) {
this.priority = priority;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#getForceAnswer()
*/
public Builder forceAnswer(String forceAnswer) {
this.forceAnswer = forceAnswer;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#isProbingEnabled()
*/
public Builder probingEnabled(boolean probingEnabled) {
this.probingEnabled = probingEnabled;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#getStatus()
*/
public Builder status(Status status) {
this.status = status;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#isServing()
*/
public Builder serving(boolean serving) {
this.serving = serving;
return this;
}
/**
* @see TrafficControllerPoolRecordDetail#getDescription()
*/
public Builder description(String description) {
this.description = description;
return this;
}
public TrafficControllerPoolRecordDetail build() {
return new TrafficControllerPoolRecordDetail(id, poolId, record, weight, priority, forceAnswer,
probingEnabled, status, serving, description);
}
public Builder from(TrafficControllerPoolRecordDetail in) {
return this.id(in.id).poolId(in.poolId).weight(in.weight).record(in.record).priority(in.priority)
.forceAnswer(in.forceAnswer).probingEnabled(in.probingEnabled).status(in.status).serving(in.serving)
.description(in.description);
}
}
}

View File

@ -34,13 +34,13 @@ public final class UpdatePoolRecord {
/** /**
* @param spec what to prime updates from * @param spec what to prime updates from
* @param pointsTo new value to point to. * @param rdata new value to point to.
*/ */
public static UpdatePoolRecord pointingTo(PoolRecordSpec spec, String pointsTo) { public static UpdatePoolRecord pointingTo(PoolRecordSpec spec, String rdata) {
return new Builder().from(spec).pointsTo(pointsTo).build(); return new Builder().from(spec).rdata(rdata).build();
} }
private final String pointsTo; private final String rdata;
private final String mode; private final String mode;
private final int priority; private final int priority;
private final int weight; private final int weight;
@ -48,26 +48,26 @@ public final class UpdatePoolRecord {
private final int threshold; private final int threshold;
private final int ttl; private final int ttl;
private UpdatePoolRecord(String pointsTo, String mode, int priority, int weight, int failOverDelay, int threshold, private UpdatePoolRecord(String rdata, String mode, int priority, int weight, int failOverDelay, int threshold,
int ttl) { int ttl) {
this.pointsTo = checkNotNull(pointsTo, "pointsTo"); this.rdata = checkNotNull(rdata, "rdata");
this.mode = checkNotNull(mode, "mode for %s", pointsTo); this.mode = checkNotNull(mode, "mode for %s", rdata);
this.priority = priority; this.priority = priority;
this.weight = weight; this.weight = weight;
checkArgument(weight >= 0, "weight of %s must be >= 0", pointsTo); checkArgument(weight >= 0, "weight of %s must be >= 0", rdata);
this.failOverDelay = failOverDelay; this.failOverDelay = failOverDelay;
checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", pointsTo); checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", rdata);
this.threshold = threshold; this.threshold = threshold;
checkArgument(threshold >= 0, "threshold of %s must be >= 0", pointsTo); checkArgument(threshold >= 0, "threshold of %s must be >= 0", rdata);
this.ttl = ttl; this.ttl = ttl;
checkArgument(ttl >= 0, "ttl of %s must be >= 0", pointsTo); checkArgument(ttl >= 0, "ttl of %s must be >= 0", rdata);
} }
/** /**
* correlates to {@link TrafficControllerPoolRecord#getPointsTo()} * correlates to {@link TrafficControllerPoolRecord#getRData()}
*/ */
public String getPointsTo() { public String getRData() {
return pointsTo; return rdata;
} }
/** /**
@ -114,7 +114,7 @@ public final class UpdatePoolRecord {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(pointsTo, mode, priority, weight, failOverDelay, threshold, ttl); return Objects.hashCode(rdata, mode, priority, weight, failOverDelay, threshold, ttl);
} }
@Override @Override
@ -126,14 +126,14 @@ public final class UpdatePoolRecord {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
UpdatePoolRecord that = UpdatePoolRecord.class.cast(obj); UpdatePoolRecord that = UpdatePoolRecord.class.cast(obj);
return equal(this.pointsTo, that.pointsTo) && equal(this.mode, that.mode) && equal(this.priority, that.priority) return equal(this.rdata, that.rdata) && equal(this.mode, that.mode) && equal(this.priority, that.priority)
&& equal(this.weight, that.weight) && equal(this.failOverDelay, that.failOverDelay) && equal(this.weight, that.weight) && equal(this.failOverDelay, that.failOverDelay)
&& equal(this.threshold, that.threshold) && equal(this.ttl, that.ttl); && equal(this.threshold, that.threshold) && equal(this.ttl, that.ttl);
} }
@Override @Override
public String toString() { public String toString() {
return toStringHelper(this).add("pointsTo", pointsTo).add("mode", mode).add("priority", priority) return toStringHelper(this).add("rdata", rdata).add("mode", mode).add("priority", priority)
.add("weight", weight).add("failOverDelay", failOverDelay).add("threshold", threshold).add("ttl", ttl) .add("weight", weight).add("failOverDelay", failOverDelay).add("threshold", threshold).add("ttl", ttl)
.toString(); .toString();
} }
@ -147,7 +147,7 @@ public final class UpdatePoolRecord {
} }
public final static class Builder { public final static class Builder {
private String pointsTo; private String rdata;
private String mode; private String mode;
private int priority; private int priority;
private int weight; private int weight;
@ -156,10 +156,10 @@ public final class UpdatePoolRecord {
private int ttl; private int ttl;
/** /**
* @see UpdatePoolRecord#getPointsTo() * @see UpdatePoolRecord#getRData()
*/ */
public Builder pointsTo(String pointsTo) { public Builder rdata(String rdata) {
this.pointsTo = pointsTo; this.rdata = rdata;
return this; return this;
} }
@ -212,7 +212,7 @@ public final class UpdatePoolRecord {
} }
public UpdatePoolRecord build() { public UpdatePoolRecord build() {
return new UpdatePoolRecord(pointsTo, mode, priority, weight, failOverDelay, threshold, ttl); return new UpdatePoolRecord(rdata, mode, priority, weight, failOverDelay, threshold, ttl);
} }
public Builder from(PoolRecordSpec in) { public Builder from(PoolRecordSpec in) {
@ -220,12 +220,12 @@ public final class UpdatePoolRecord {
.threshold(in.getThreshold()).ttl(in.getTTL()); .threshold(in.getThreshold()).ttl(in.getTTL());
} }
public Builder from(TrafficControllerPoolRecord in) { public Builder from(TrafficControllerPoolRecordDetail in) {
return this.weight(in.getWeight()).pointsTo(in.getPointsTo()).priority(in.getPriority()); return this.weight(in.getWeight()).rdata(in.getRecord().getRData()).priority(in.getPriority());
} }
public Builder from(UpdatePoolRecord in) { public Builder from(UpdatePoolRecord in) {
return this.pointsTo(in.pointsTo).mode(in.mode).priority(in.priority).weight(in.weight) return this.rdata(in.rdata).mode(in.mode).priority(in.priority).weight(in.weight)
.failOverDelay(in.failOverDelay).threshold(in.threshold).ttl(in.ttl); .failOverDelay(in.failOverDelay).threshold(in.threshold).ttl(in.ttl);
} }
} }

View File

@ -36,11 +36,11 @@ import org.jclouds.ultradns.ws.binders.DirectionalGroupCoordinatesToXML;
import org.jclouds.ultradns.ws.domain.AccountLevelGroup; import org.jclouds.ultradns.ws.domain.AccountLevelGroup;
import org.jclouds.ultradns.ws.domain.DirectionalGroup; import org.jclouds.ultradns.ws.domain.DirectionalGroup;
import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates; import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.AccountLevelGroupsHandler; import org.jclouds.ultradns.ws.xml.AccountLevelGroupsHandler;
import org.jclouds.ultradns.ws.xml.DirectionalGroupNameAndRegionsHandler; import org.jclouds.ultradns.ws.xml.DirectionalGroupHandler;
import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler; import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler;
import org.jclouds.ultradns.ws.xml.ItemListHandler; import org.jclouds.ultradns.ws.xml.ItemListHandler;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -63,7 +63,7 @@ public interface DirectionalGroupApi {
*/ */
@Named("getDirectionalDNSGroupDetails") @Named("getDirectionalDNSGroupDetails")
@POST @POST
@XMLResponseParser(DirectionalGroupNameAndRegionsHandler.class) @XMLResponseParser(DirectionalGroupHandler.class)
@Fallback(NullOnNotFoundOr404.class) @Fallback(NullOnNotFoundOr404.class)
@Payload("<v01:getDirectionalDNSGroupDetails><GroupId>{GroupId}</GroupId></v01:getDirectionalDNSGroupDetails>") @Payload("<v01:getDirectionalDNSGroupDetails><GroupId>{GroupId}</GroupId></v01:getDirectionalDNSGroupDetails>")
@Nullable @Nullable
@ -89,9 +89,9 @@ public interface DirectionalGroupApi {
*/ */
@Named("getDirectionalDNSRecordsForAcctLvlGroup") @Named("getDirectionalDNSRecordsForAcctLvlGroup")
@POST @POST
@XMLResponseParser(DirectionalRecordDetailListHandler.class) @XMLResponseParser(DirectionalPoolRecordDetailListHandler.class)
@Payload("<v01:getDirectionalDNSRecordsForAcctLvlGroup><groupId>{groupId}</groupId></v01:getDirectionalDNSRecordsForAcctLvlGroup>") @Payload("<v01:getDirectionalDNSRecordsForAcctLvlGroup><groupId>{groupId}</groupId></v01:getDirectionalDNSRecordsForAcctLvlGroup>")
FluentIterable<DirectionalRecordDetail> listRecordsByAccountLevelGroup( FluentIterable<DirectionalPoolRecordDetail> listRecordsByAccountLevelGroup(
@PayloadParam("groupId") String groupId) throws ResourceNotFoundException; @PayloadParam("groupId") String groupId) throws ResourceNotFoundException;
/** /**
@ -126,9 +126,9 @@ public interface DirectionalGroupApi {
*/ */
@Named("getDirectionalDNSRecordsForGroup") @Named("getDirectionalDNSRecordsForGroup")
@POST @POST
@XMLResponseParser(DirectionalRecordDetailListHandler.class) @XMLResponseParser(DirectionalPoolRecordDetailListHandler.class)
@Fallback(EmptyFluentIterableOnNotFoundOr404.class) @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
FluentIterable<DirectionalRecordDetail> listRecordsByGroupCoordinates( FluentIterable<DirectionalPoolRecordDetail> listRecordsByGroupCoordinates(
@BinderParam(DirectionalGroupCoordinatesToXML.class) DirectionalGroupCoordinates group) @BinderParam(DirectionalGroupCoordinatesToXML.class) DirectionalGroupCoordinates group)
throws ResourceNotFoundException; throws ResourceNotFoundException;
} }

View File

@ -30,10 +30,10 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost; import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.ultradns.ws.domain.DirectionalPool; import org.jclouds.ultradns.ws.domain.DirectionalPool;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.DirectionalPoolListHandler; import org.jclouds.ultradns.ws.xml.DirectionalPoolListHandler;
import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler; import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -75,10 +75,10 @@ public interface DirectionalPoolApi {
*/ */
@Named("getDirectionalDNSRecordsForHost") @Named("getDirectionalDNSRecordsForHost")
@POST @POST
@XMLResponseParser(DirectionalRecordDetailListHandler.class) @XMLResponseParser(DirectionalPoolRecordDetailListHandler.class)
@Fallback(EmptyFluentIterableOnNotFoundOr404.class) @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
@Payload("<v01:getDirectionalDNSRecordsForHost><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><poolRecordType>{poolRecordType}</poolRecordType></v01:getDirectionalDNSRecordsForHost>") @Payload("<v01:getDirectionalDNSRecordsForHost><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><poolRecordType>{poolRecordType}</poolRecordType></v01:getDirectionalDNSRecordsForHost>")
FluentIterable<DirectionalRecordDetail> listRecordsByNameAndType( FluentIterable<DirectionalPoolRecordDetail> listRecordsByNameAndType(
@PayloadParam("hostName") String dname, @PayloadParam("poolRecordType") int type) @PayloadParam("hostName") String dname, @PayloadParam("poolRecordType") int type)
throws ResourceNotFoundException; throws ResourceNotFoundException;
} }

View File

@ -33,7 +33,7 @@ import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML; import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML;
import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.ElementTextHandler;
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
@ -92,7 +92,7 @@ public interface ResourceRecordApi {
@POST @POST
@XMLResponseParser(ResourceRecordListHandler.class) @XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfZone><zoneName>{zoneName}</zoneName><rrType>0</rrType></v01:getResourceRecordsOfZone>") @Payload("<v01:getResourceRecordsOfZone><zoneName>{zoneName}</zoneName><rrType>0</rrType></v01:getResourceRecordsOfZone>")
FluentIterable<ResourceRecordMetadata> list() throws ResourceNotFoundException; FluentIterable<ResourceRecordDetail> list() throws ResourceNotFoundException;
/** /**
* Returns all the specified record types in the zone with the fully * Returns all the specified record types in the zone with the fully
@ -107,7 +107,7 @@ public interface ResourceRecordApi {
@POST @POST
@XMLResponseParser(ResourceRecordListHandler.class) @XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>0</rrType></v01:getResourceRecordsOfDNameByType>") @Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>0</rrType></v01:getResourceRecordsOfDNameByType>")
FluentIterable<ResourceRecordMetadata> listByName(@PayloadParam("hostName") String hostName) FluentIterable<ResourceRecordDetail> listByName(@PayloadParam("hostName") String hostName)
throws ResourceNotFoundException; throws ResourceNotFoundException;
/** /**
@ -126,7 +126,7 @@ public interface ResourceRecordApi {
@POST @POST
@XMLResponseParser(ResourceRecordListHandler.class) @XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>{rrType}</rrType></v01:getResourceRecordsOfDNameByType>") @Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>{rrType}</rrType></v01:getResourceRecordsOfDNameByType>")
FluentIterable<ResourceRecordMetadata> listByNameAndType( FluentIterable<ResourceRecordDetail> listByNameAndType(
@PayloadParam("hostName") String hostName, @PayloadParam("rrType") int rrType) @PayloadParam("hostName") String hostName, @PayloadParam("rrType") int rrType)
throws ResourceNotFoundException; throws ResourceNotFoundException;

View File

@ -31,7 +31,7 @@ import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.jclouds.ultradns.ws.domain.RoundRobinPool; import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.ElementTextHandler;
@ -71,7 +71,7 @@ public interface RoundRobinPoolApi {
@POST @POST
@XMLResponseParser(ResourceRecordListHandler.class) @XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getRRPoolRecords><lbPoolId>{poolId}</lbPoolId></v01:getRRPoolRecords>") @Payload("<v01:getRRPoolRecords><lbPoolId>{poolId}</lbPoolId></v01:getRRPoolRecords>")
FluentIterable<ResourceRecordMetadata> listRecords(@PayloadParam("poolId") String poolId) FluentIterable<ResourceRecordDetail> listRecords(@PayloadParam("poolId") String poolId)
throws ResourceNotFoundException; throws ResourceNotFoundException;
/** /**
@ -79,7 +79,7 @@ public interface RoundRobinPoolApi {
* *
* @param name * @param name
* {@link RoundRobinPool#getName() name} of the RR pool * {@link RoundRobinPool#getName() name} of the RR pool
* @param hostname * @param dname
* {@link RoundRobinPool#getDName() dname} of the RR pool {ex. * {@link RoundRobinPool#getDName() dname} of the RR pool {ex.
* www.jclouds.org.} * www.jclouds.org.}
* @return the {@code guid} of the new pool * @return the {@code guid} of the new pool
@ -90,8 +90,8 @@ public interface RoundRobinPoolApi {
@POST @POST
@XMLResponseParser(ElementTextHandler.RRPoolID.class) @XMLResponseParser(ElementTextHandler.RRPoolID.class)
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><rrGUID /></v01:addRRLBPool>") @Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><rrGUID /></v01:addRRLBPool>")
String createAPoolForHostname(@PayloadParam("description") String name, String createAPoolForDName(@PayloadParam("description") String name,
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; @PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException;
/** /**
* adds a new {@code A} record to the pool * adds a new {@code A} record to the pool
@ -155,8 +155,8 @@ public interface RoundRobinPoolApi {
* *
* @param name * @param name
* {@link RoundRobinPool#getName() name} of the RR pool * {@link RoundRobinPool#getName() name} of the RR pool
* @param hostname * @param dname
* {@link RoundRobinPool#getDName() hostname} {ex. * {@link RoundRobinPool#getDName() dname} {ex.
* www.jclouds.org.} * www.jclouds.org.}
* @return the {@code guid} of the new record * @return the {@code guid} of the new record
* @throws ResourceAlreadyExistsException * @throws ResourceAlreadyExistsException
@ -166,8 +166,8 @@ public interface RoundRobinPoolApi {
@POST @POST
@XMLResponseParser(ElementTextHandler.RRPoolID.class) @XMLResponseParser(ElementTextHandler.RRPoolID.class)
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool>") @Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool>")
String createAAAAPoolForHostname(@PayloadParam("description") String name, String createAAAAPoolForDName(@PayloadParam("description") String name,
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; @PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException;
/** /**
* adds a new {@code AAAA} record to the pool * adds a new {@code AAAA} record to the pool

View File

@ -36,14 +36,15 @@ import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsExcepti
import org.jclouds.ultradns.ws.binders.UpdatePoolRecordToXML; import org.jclouds.ultradns.ws.binders.UpdatePoolRecordToXML;
import org.jclouds.ultradns.ws.domain.PoolRecordSpec; import org.jclouds.ultradns.ws.domain.PoolRecordSpec;
import org.jclouds.ultradns.ws.domain.TrafficControllerPool; import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; import org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail;
import org.jclouds.ultradns.ws.domain.UpdatePoolRecord; import org.jclouds.ultradns.ws.domain.UpdatePoolRecord;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.AttributeHandler; import org.jclouds.ultradns.ws.xml.AttributeHandler;
import org.jclouds.ultradns.ws.xml.ElementTextHandler; import org.jclouds.ultradns.ws.xml.ElementTextHandler;
import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler; import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler;
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler; import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler;
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler; import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordDetailListHandler;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -61,9 +62,11 @@ public interface TrafficControllerPoolApi {
* *
* @param name * @param name
* {@link TrafficControllerPool#getName() name} of the TC pool * {@link TrafficControllerPool#getName() name} of the TC pool
* @param hostname * @param dname
* {@link TrafficControllerPool#getDName() dname} of the TC pool * {@link TrafficControllerPool#getDName() dname} of the TC pool
* {ex. www.jclouds.org.} * {ex. www.jclouds.org.}
* @param type
* the record types supported.
* @return the {@code guid} of the new record * @return the {@code guid} of the new record
* @throws ResourceAlreadyExistsException * @throws ResourceAlreadyExistsException
* if a pool already exists with the same attrs * if a pool already exists with the same attrs
@ -71,9 +74,9 @@ public interface TrafficControllerPoolApi {
@Named("addTCLBPool") @Named("addTCLBPool")
@POST @POST
@XMLResponseParser(ElementTextHandler.TCPoolID.class) @XMLResponseParser(ElementTextHandler.TCPoolID.class)
@Payload("<v01:addTCLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool>") @Payload("<v01:addTCLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>{poolRecordType}</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool>")
String createPoolForHostname(@PayloadParam("description") String name, @PayloadParam("hostName") String hostname) String createPoolForDNameAndType(@PayloadParam("description") String name, @PayloadParam("hostName") String dname,
throws ResourceAlreadyExistsException; @PayloadParam("poolRecordType") RecordType type) throws ResourceAlreadyExistsException;
/** /**
* Returns all traffic controller pools in the zone. * Returns all traffic controller pools in the zone.
@ -95,9 +98,9 @@ public interface TrafficControllerPoolApi {
*/ */
@Named("getPoolRecords") @Named("getPoolRecords")
@POST @POST
@XMLResponseParser(TrafficControllerPoolRecordListHandler.class) @XMLResponseParser(TrafficControllerPoolRecordDetailListHandler.class)
@Payload("<v01:getPoolRecords><poolId>{poolId}</poolId></v01:getPoolRecords>") @Payload("<v01:getPoolRecords><poolId>{poolId}</poolId></v01:getPoolRecords>")
FluentIterable<TrafficControllerPoolRecord> listRecords(@PayloadParam("poolId") String poolId) FluentIterable<TrafficControllerPoolRecordDetail> listRecords(@PayloadParam("poolId") String poolId)
throws ResourceNotFoundException; throws ResourceNotFoundException;
/** /**
@ -130,13 +133,13 @@ public interface TrafficControllerPoolApi {
/** /**
* adds a new record to the pool with default weight. * adds a new record to the pool with default weight.
* *
* @param pointsTo * @param rdata
* the ipv4 address or hostname * the ipv4 address or hostname
* @param lbPoolID * @param lbPoolID
* the pool to add the record to. * the pool to add the record to.
* @param ttl * @param ttl
* the {@link PoolRecordSpec#getTTL ttl} of the record * the {@link PoolRecordSpec#getTTL ttl} of the record
* @return the {@link TrafficControllerPoolRecord#getId() id} of the new * @return the {@link TrafficControllerPoolRecordDetail#getId() id} of the new
* record * record
* @throws ResourceAlreadyExistsException * @throws ResourceAlreadyExistsException
* if a record already exists with the same attrs * if a record already exists with the same attrs
@ -145,13 +148,13 @@ public interface TrafficControllerPoolApi {
@POST @POST
@XMLResponseParser(ElementTextHandler.PoolRecordID.class) @XMLResponseParser(ElementTextHandler.PoolRecordID.class)
@Payload("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight /><mode /><threshold /></v01:addPoolRecord>") @Payload("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight /><mode /><threshold /></v01:addPoolRecord>")
String addRecordToPoolWithTTL(@PayloadParam("pointsTo") String pointsTo, @PayloadParam("poolID") String lbPoolID, String addRecordToPoolWithTTL(@PayloadParam("pointsTo") String rdata, @PayloadParam("poolID") String lbPoolID,
@PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException;
/** /**
* adds a new record to the pool with a specified weight. * adds a new record to the pool with a specified weight.
* *
* @param pointsTo * @param rdata
* the ipv4 address or hostname * the ipv4 address or hostname
* @param lbPoolID * @param lbPoolID
* the pool to add the record to. * the pool to add the record to.
@ -159,7 +162,7 @@ public interface TrafficControllerPoolApi {
* the {@link PoolRecordSpec#getTTL ttl} of the record * the {@link PoolRecordSpec#getTTL ttl} of the record
* @param weight * @param weight
* the {@link PoolRecordSpec#getWeight() weight} of the record * the {@link PoolRecordSpec#getWeight() weight} of the record
* @return the {@link TrafficControllerPoolRecord#getId() id} of the new * @return the {@link TrafficControllerPoolRecordDetail#getId() id} of the new
* record * record
* @throws ResourceAlreadyExistsException * @throws ResourceAlreadyExistsException
* if a record already exists with the same attrs * if a record already exists with the same attrs
@ -168,13 +171,13 @@ public interface TrafficControllerPoolApi {
@POST @POST
@XMLResponseParser(ElementTextHandler.PoolRecordID.class) @XMLResponseParser(ElementTextHandler.PoolRecordID.class)
@Payload("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight>{weight}</weight><mode /><threshold /></v01:addPoolRecord>") @Payload("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight>{weight}</weight><mode /><threshold /></v01:addPoolRecord>")
String addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String pointsTo, String addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String rdata,
@PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl, @PayloadParam("weight") int weight) @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl, @PayloadParam("weight") int weight)
throws ResourceAlreadyExistsException; throws ResourceAlreadyExistsException;
/** /**
* @param poolRecordID * @param poolRecordID
* {@link TrafficControllerPoolRecord#getId()} * {@link TrafficControllerPoolRecordDetail#getId()}
* @return null if not found * @return null if not found
*/ */
@Named("getPoolRecordSpec>") @Named("getPoolRecordSpec>")
@ -189,7 +192,7 @@ public interface TrafficControllerPoolApi {
* This request updates an existing pool record. * This request updates an existing pool record.
* *
* @param poolRecordID * @param poolRecordID
* {@link TrafficControllerPoolRecord#getId()} * {@link TrafficControllerPoolRecordDetail#getId()}
* @param update * @param update
* what to update, usually primed via * what to update, usually primed via
* {@link UpdatePoolRecord#pointingTo(PoolRecordSpec, String)} or * {@link UpdatePoolRecord#pointingTo(PoolRecordSpec, String)} or

View File

@ -0,0 +1,78 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.ultradns.ws.predicates;
import static com.google.common.base.Preconditions.checkNotNull;
import org.jclouds.ultradns.ws.domain.DirectionalPool;
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import com.google.common.base.Predicate;
/**
* Predicates handy when working with DirectionalPool Types
*
* @author Adrian Cole
*/
public class DirectionalPoolPredicates {
public static Predicate<DirectionalPool> idEqualTo(String id) {
return new IdEqualToPredicate(id);
}
private static final class IdEqualToPredicate implements Predicate<DirectionalPool> {
private final String id;
public IdEqualToPredicate(String id) {
this.id = checkNotNull(id, "id");
}
@Override
public boolean apply(DirectionalPool input) {
return input != null && id.equals(input.getId());
}
@Override
public String toString() {
return "IdEqualTo(" + id + ")";
}
}
public static Predicate<DirectionalPoolRecordDetail> recordIdEqualTo(String recordId) {
return new RecordIdEqualToPredicate(recordId);
}
private static final class RecordIdEqualToPredicate implements Predicate<DirectionalPoolRecordDetail> {
private final String recordId;
public RecordIdEqualToPredicate(String recordId) {
this.recordId = checkNotNull(recordId, "recordId");
}
@Override
public boolean apply(DirectionalPoolRecordDetail input) {
return input != null && recordId.equals(input.getId());
}
@Override
public String toString() {
return "RecordIdEqualTo(" + recordId + ")";
}
}
}

View File

@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.predicates;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import org.jclouds.ultradns.ws.domain.TrafficControllerPool; import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
@ -54,11 +54,11 @@ public class TrafficControllerPoolPredicates {
} }
} }
public static Predicate<TrafficControllerPoolRecord> recordIdEqualTo(String recordId) { public static Predicate<TrafficControllerPoolRecordDetail> recordIdEqualTo(String recordId) {
return new RecordIdEqualToPredicate(recordId); return new RecordIdEqualToPredicate(recordId);
} }
private static final class RecordIdEqualToPredicate implements Predicate<TrafficControllerPoolRecord> { private static final class RecordIdEqualToPredicate implements Predicate<TrafficControllerPoolRecordDetail> {
private final String recordId; private final String recordId;
public RecordIdEqualToPredicate(String recordId) { public RecordIdEqualToPredicate(String recordId) {
@ -66,7 +66,7 @@ public class TrafficControllerPoolPredicates {
} }
@Override @Override
public boolean apply(TrafficControllerPoolRecord input) { public boolean apply(TrafficControllerPoolRecordDetail input) {
return input != null && recordId.equals(input.getId()); return input != null && recordId.equals(input.getId());
} }

View File

@ -48,7 +48,7 @@ public class AccountHandler extends ParseSax.HandlerForGeneratedRequestWithResul
public void startElement(String uri, String localName, String qName, Attributes attrs) { public void startElement(String uri, String localName, String qName, Attributes attrs) {
Map<String, String> attributes = cleanseAttributes(attrs); Map<String, String> attributes = cleanseAttributes(attrs);
if (equalsOrSuffix(qName, "AccountDetailsData")) { if (equalsOrSuffix(qName, "AccountDetailsData")) {
account = IdAndName.fromIdAndName(attributes.get("accountID"), attributes.get("accountName")); account = IdAndName.create(attributes.get("accountID"), attributes.get("accountName"));
} }
} }
} }

View File

@ -26,12 +26,13 @@ import org.jclouds.ultradns.ws.domain.DirectionalGroup.Builder;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSortedSet;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGeneratedRequestWithResult<DirectionalGroup> { public class DirectionalGroupHandler extends ParseSax.HandlerForGeneratedRequestWithResult<DirectionalGroup> {
private final Builder group = DirectionalGroup.builder(); private final Builder group = DirectionalGroup.builder();
@ -44,10 +45,12 @@ public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGe
public void startElement(String url, String name, String qName, Attributes attrs) { public void startElement(String url, String name, String qName, Attributes attrs) {
if (equalsOrSuffix(qName, "DirectionalDNSGroupDetail")) { if (equalsOrSuffix(qName, "DirectionalDNSGroupDetail")) {
group.name(attrs.getValue("GroupName")); group.name(attrs.getValue("GroupName"));
group.description(attrs.getValue("Description"));
} else if (equalsOrSuffix(qName, "RegionForNewGroups")) { } else if (equalsOrSuffix(qName, "RegionForNewGroups")) {
String regionName = attrs.getValue("RegionName"); String regionName = attrs.getValue("RegionName");
Iterable<String> territories = Splitter.on(';').split(attrs.getValue("TerritoryName")); Iterable<String> territories = Splitter.on(';').split(attrs.getValue("TerritoryName"));
group.mapRegionToTerritories(regionName, territories); // for some reason, this isn't sorted here, though it is in other parts of the api. manually sort.
group.mapRegionToTerritories(regionName, ImmutableSortedSet.copyOf(territories));
} }
} }
} }

View File

@ -54,8 +54,8 @@ public class DirectionalPoolListHandler extends ParseSax.HandlerForGeneratedRequ
DirectionalPool.Builder pool = DirectionalPool.builder() DirectionalPool.Builder pool = DirectionalPool.builder()
.zoneId(attributes.get("Zoneid")) .zoneId(attributes.get("Zoneid"))
.id(attributes.get("dirpoolid")) .id(attributes.get("dirpoolid"))
.name(attributes.get("Pooldname")) .dname(attributes.get("Pooldname"))
.description(attributes.get("Description")); .name(attributes.get("Description"));
String type = attributes.get("DirPoolType"); String type = attributes.get("DirPoolType");
if (type != null) if (type != null)

View File

@ -25,30 +25,30 @@ import java.util.Map;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import static org.jclouds.ultradns.ws.domain.IdAndName.*; import static org.jclouds.ultradns.ws.domain.IdAndName.*;
import org.jclouds.ultradns.ws.domain.DirectionalRecord; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class DirectionalRecordDetailHandler extends public class DirectionalPoolRecordDetailHandler extends
ParseSax.HandlerForGeneratedRequestWithResult<DirectionalRecordDetail> { ParseSax.HandlerForGeneratedRequestWithResult<DirectionalPoolRecordDetail> {
private DirectionalRecordDetail.Builder drd = DirectionalRecordDetail.builder(); private DirectionalPoolRecordDetail.Builder drd = DirectionalPoolRecordDetail.builder();
private DirectionalRecord.Builder dr = DirectionalRecord.drBuilder(); private DirectionalPoolRecord.Builder dr = DirectionalPoolRecord.drBuilder();
private String zoneName; private String zoneName;
private String dname; private String dname;
@Override @Override
public DirectionalRecordDetail getResult() { public DirectionalPoolRecordDetail getResult() {
try { try {
return drd.record(dr.build()).build(); return drd.record(dr.build()).build();
} finally { } finally {
drd = DirectionalRecordDetail.builder().zoneName(zoneName).name(dname); drd = DirectionalPoolRecordDetail.builder().zoneName(zoneName).name(dname);
dr = DirectionalRecord.drBuilder(); dr = DirectionalPoolRecord.drBuilder();
} }
} }
@ -64,14 +64,14 @@ public class DirectionalRecordDetailHandler extends
drd.id(attributes.get("DirPoolRecordId")); drd.id(attributes.get("DirPoolRecordId"));
} }
if (attributes.containsKey("GroupId")) { if (attributes.containsKey("GroupId")) {
drd.group(fromIdAndName(attributes.get("GroupId"), attributes.get("GroupName"))); drd.group(create(attributes.get("GroupId"), attributes.get("GroupName")));
} }
if (attributes.containsKey("GeolocationGroupId")) { if (attributes.containsKey("GeolocationGroupId")) {
drd.geolocationGroup(fromIdAndName(attributes.get("GeolocationGroupId"), drd.geolocationGroup(create(attributes.get("GeolocationGroupId"),
attributes.get("GeolocationGroupName"))); attributes.get("GeolocationGroupName")));
} }
if (attributes.containsKey("SourceIPGroupId")) { if (attributes.containsKey("SourceIPGroupId")) {
drd.sourceIpGroup(fromIdAndName(attributes.get("SourceIPGroupId"), attributes.get("SourceIPGroupName"))); drd.sourceIpGroup(create(attributes.get("SourceIPGroupId"), attributes.get("SourceIPGroupName")));
} }
if (attributes.containsKey("recordType")) { if (attributes.containsKey("recordType")) {
dr.type(attributes.get("recordType")); dr.type(attributes.get("recordType"));

View File

@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.xml;
import static org.jclouds.util.SaxUtils.equalsOrSuffix; import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -33,20 +33,20 @@ import com.google.inject.Inject;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class DirectionalRecordDetailListHandler extends public class DirectionalPoolRecordDetailListHandler extends
ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<DirectionalRecordDetail>> { ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<DirectionalPoolRecordDetail>> {
private final DirectionalRecordDetailHandler directionalRecordHandler; private final DirectionalPoolRecordDetailHandler directionalRecordHandler;
private final Builder<DirectionalRecordDetail> drs = ImmutableSet.<DirectionalRecordDetail> builder(); private final Builder<DirectionalPoolRecordDetail> drs = ImmutableSet.<DirectionalPoolRecordDetail> builder();
@Inject @Inject
public DirectionalRecordDetailListHandler(DirectionalRecordDetailHandler directionalRecordHandler) { public DirectionalPoolRecordDetailListHandler(DirectionalPoolRecordDetailHandler directionalRecordHandler) {
this.directionalRecordHandler = directionalRecordHandler; this.directionalRecordHandler = directionalRecordHandler;
} }
@Override @Override
public FluentIterable<DirectionalRecordDetail> getResult() { public FluentIterable<DirectionalPoolRecordDetail> getResult() {
return FluentIterable.from(drs.build()); return FluentIterable.from(drs.build());
} }

View File

@ -49,7 +49,7 @@ public class RegionListHandler extends ParseSax.HandlerForGeneratedRequestWithRe
public void startElement(String url, String name, String qName, Attributes attrs) { public void startElement(String url, String name, String qName, Attributes attrs) {
if (equalsOrSuffix(qName, "Region")) { if (equalsOrSuffix(qName, "Region")) {
Map<String, String> attributes = cleanseAttributes(attrs); Map<String, String> attributes = cleanseAttributes(attrs);
IdAndName region = IdAndName.fromIdAndName(attributes.get("RegionID"), attributes.get("RegionName")); IdAndName region = IdAndName.create(attributes.get("RegionID"), attributes.get("RegionName"));
regions.putAll(region, Splitter.on(';').split(attributes.get("TerritoryName"))); regions.putAll(region, Splitter.on(';').split(attributes.get("TerritoryName")));
} }
} }

View File

@ -26,7 +26,7 @@ import java.util.Map;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.inject.Inject; import com.google.inject.Inject;
@ -35,24 +35,24 @@ import com.google.inject.Inject;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ResourceRecordMetadataHandler extends public class ResourceRecordDetailHandler extends
ParseSax.HandlerForGeneratedRequestWithResult<ResourceRecordMetadata> { ParseSax.HandlerForGeneratedRequestWithResult<ResourceRecordDetail> {
private final DateService dateService; private final DateService dateService;
@Inject @Inject
private ResourceRecordMetadataHandler(DateService dateService) { private ResourceRecordDetailHandler(DateService dateService) {
this.dateService = dateService; this.dateService = dateService;
} }
private ResourceRecordMetadata.Builder rrm = ResourceRecordMetadata.builder(); private ResourceRecordDetail.Builder rrm = ResourceRecordDetail.builder();
private ResourceRecord.Builder rr = ResourceRecord.rrBuilder(); private ResourceRecord.Builder rr = ResourceRecord.rrBuilder();
@Override @Override
public ResourceRecordMetadata getResult() { public ResourceRecordDetail getResult() {
try { try {
return rrm.record(rr.build()).build(); return rrm.record(rr.build()).build();
} finally { } finally {
rrm = ResourceRecordMetadata.builder(); rrm = ResourceRecordDetail.builder();
rr = ResourceRecord.rrBuilder(); rr = ResourceRecord.rrBuilder();
} }
} }

View File

@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.xml;
import static org.jclouds.util.SaxUtils.equalsOrSuffix; import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -34,19 +34,19 @@ import com.google.inject.Inject;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class ResourceRecordListHandler extends public class ResourceRecordListHandler extends
ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<ResourceRecordMetadata>> { ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<ResourceRecordDetail>> {
private final ResourceRecordMetadataHandler resourceRecordHandler; private final ResourceRecordDetailHandler resourceRecordHandler;
private Builder<ResourceRecordMetadata> rrs = ImmutableSet.<ResourceRecordMetadata> builder(); private Builder<ResourceRecordDetail> rrs = ImmutableSet.<ResourceRecordDetail> builder();
@Inject @Inject
public ResourceRecordListHandler(ResourceRecordMetadataHandler resourceRecordHandler) { public ResourceRecordListHandler(ResourceRecordDetailHandler resourceRecordHandler) {
this.resourceRecordHandler = resourceRecordHandler; this.resourceRecordHandler = resourceRecordHandler;
} }
@Override @Override
public FluentIterable<ResourceRecordMetadata> getResult() { public FluentIterable<ResourceRecordDetail> getResult() {
return FluentIterable.from(rrs.build()); return FluentIterable.from(rrs.build());
} }

View File

@ -51,7 +51,7 @@ public class RoundRobinPoolHandler extends ParseSax.HandlerForGeneratedRequestWi
if (equalsOrSuffix(qName, "LBPoolData")) { if (equalsOrSuffix(qName, "LBPoolData")) {
pool.zoneId(attributes.get("zoneid")); pool.zoneId(attributes.get("zoneid"));
} else if (equalsOrSuffix(qName, "PoolData")) { } else if (equalsOrSuffix(qName, "PoolData")) {
pool.id(attributes.get("PoolId")).name(attributes.get("PoolName")).dname(attributes.get("PoolDName")); pool.id(attributes.get("PoolId")).name(attributes.get("description")).dname(attributes.get("PoolDName"));
} }
} }
} }

View File

@ -51,7 +51,7 @@ public class TrafficControllerPoolHandler extends ParseSax.HandlerForGeneratedRe
if (equalsOrSuffix(qName, "LBPoolData")) { if (equalsOrSuffix(qName, "LBPoolData")) {
pool.zoneId(attributes.get("zoneid")); pool.zoneId(attributes.get("zoneid"));
} else if (equalsOrSuffix(qName, "PoolData")) { } else if (equalsOrSuffix(qName, "PoolData")) {
pool.id(attributes.get("PoolId")).name(attributes.get("PoolName")).dname(attributes.get("PoolDName")); pool.id(attributes.get("PoolId")).name(attributes.get("description")).dname(attributes.get("PoolDName"));
pool.statusCode(Integer.parseInt(attributes.get("PoolStatus"))); pool.statusCode(Integer.parseInt(attributes.get("PoolStatus")));
pool.failOverEnabled("Enabled".equalsIgnoreCase(attributes.get("FailOver"))); pool.failOverEnabled("Enabled".equalsIgnoreCase(attributes.get("FailOver")));
pool.probingEnabled("Enabled".equalsIgnoreCase(attributes.get("Probing"))); pool.probingEnabled("Enabled".equalsIgnoreCase(attributes.get("Probing")));

View File

@ -26,7 +26,8 @@ import java.util.Map;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -37,13 +38,13 @@ import com.google.common.collect.ImmutableSet.Builder;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class TrafficControllerPoolRecordListHandler extends public class TrafficControllerPoolRecordDetailListHandler extends
ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<TrafficControllerPoolRecord>> { ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<TrafficControllerPoolRecordDetail>> {
private final Builder<TrafficControllerPoolRecord> records = ImmutableSet.<TrafficControllerPoolRecord> builder(); private final Builder<TrafficControllerPoolRecordDetail> records = ImmutableSet.<TrafficControllerPoolRecordDetail> builder();
@Override @Override
public FluentIterable<TrafficControllerPoolRecord> getResult() { public FluentIterable<TrafficControllerPoolRecordDetail> getResult() {
return FluentIterable.from(records.build()); return FluentIterable.from(records.build());
} }
@ -52,13 +53,15 @@ public class TrafficControllerPoolRecordListHandler extends
if (!equalsOrSuffix(qName, "PoolRecordData")) if (!equalsOrSuffix(qName, "PoolRecordData"))
return; return;
Map<String, String> attributes = cleanseAttributes(attrs); Map<String, String> attributes = cleanseAttributes(attrs);
records.add(TrafficControllerPoolRecord.builder() TrafficControllerPoolRecord record = TrafficControllerPoolRecord.create(
attributes.get("recordType"),
attributes.get("pointsTo"));
records.add(TrafficControllerPoolRecordDetail.builder()
.id(attributes.get("poolRecordID")) .id(attributes.get("poolRecordID"))
.poolId(attributes.get("poolId")) .poolId(attributes.get("poolId"))
.pointsTo(attributes.get("pointsTo")) .record(record)
.weight(parseInt(checkNotNull(attributes.get("weight"), "weight"))) .weight(parseInt(checkNotNull(attributes.get("weight"), "weight")))
.priority(parseInt(checkNotNull(attributes.get("priority"), "priority"))) .priority(parseInt(checkNotNull(attributes.get("priority"), "priority")))
.type(attributes.get("recordType"))
.forceAnswer(attributes.get("forceAnswer")) .forceAnswer(attributes.get("forceAnswer"))
.probingEnabled("ENABLED".equalsIgnoreCase(attributes.get("probing"))) .probingEnabled("ENABLED".equalsIgnoreCase(attributes.get("probing")))
.status(Status.valueOf(attributes.get("status"))) .status(Status.valueOf(attributes.get("status")))

View File

@ -65,7 +65,7 @@ public class UltraDNSWSApiExpectTest extends BaseUltraDNSWSApiExpectTest {
UltraDNSWSApi success = requestSendsResponse(getRegionsById, getRegionsByIdResponse); UltraDNSWSApi success = requestSendsResponse(getRegionsById, getRegionsByIdResponse);
assertEquals( assertEquals(
success.getRegionsById().toString(), success.getRegionsByIdAndName().toString(),
new GetAvailableRegionsResponseTest().expected().toString()); new GetAvailableRegionsResponseTest().expected().toString());
} }
} }

View File

@ -47,7 +47,7 @@ public class UltraDNSWSApiLiveTest extends BaseUltraDNSWSApiLiveTest {
@Test @Test
public void testListRegions() { public void testListRegions() {
for (Entry<IdAndName, Collection<String>> region : api.getRegionsById().asMap().entrySet()) { for (Entry<IdAndName, Collection<String>> region : api.getRegionsByIdAndName().asMap().entrySet()) {
checkRegion(region); checkRegion(region);
} }
} }

View File

@ -26,13 +26,13 @@ import java.util.EnumSet;
import java.util.Set; import java.util.Set;
import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.ultradns.ws.domain.IdAndName;
import org.jclouds.ultradns.ws.domain.AccountLevelGroup; import org.jclouds.ultradns.ws.domain.AccountLevelGroup;
import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates;
import org.jclouds.ultradns.ws.domain.DirectionalGroup; import org.jclouds.ultradns.ws.domain.DirectionalGroup;
import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates;
import org.jclouds.ultradns.ws.domain.DirectionalPool; import org.jclouds.ultradns.ws.domain.DirectionalPool;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType;
import org.jclouds.ultradns.ws.domain.DirectionalRecordType; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.jclouds.ultradns.ws.domain.IdAndName;
import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
@ -72,7 +72,7 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
@Test @Test
public void testListRecordsByAccountLevelGroup() { public void testListRecordsByAccountLevelGroup() {
for (AccountLevelGroup group : api().listAccountLevelGroups()) { for (AccountLevelGroup group : api().listAccountLevelGroups()) {
for (DirectionalRecordDetail rr : api().listRecordsByAccountLevelGroup(group.getId())) { for (DirectionalPoolRecordDetail rr : api().listRecordsByAccountLevelGroup(group.getId())) {
DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr); DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr);
} }
} }
@ -93,11 +93,11 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
public void testListGroupNamesByRecordNameAndType() { public void testListGroupNamesByRecordNameAndType() {
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
for (DirectionalPool pool : api.getDirectionalPoolApiForZone(zone.getName()).list()) { for (DirectionalPool pool : api.getDirectionalPoolApiForZone(zone.getName()).list()) {
for (DirectionalRecordType type : EnumSet.allOf(DirectionalRecordType.class)) { for (RecordType type : EnumSet.allOf(RecordType.class)) {
for (String groupName : api().listGroupNamesByRecordNameAndType(pool.getName(), type.getCode())) { for (String groupName : api().listGroupNamesByRecordNameAndType(pool.getDName(), type.getCode())) {
allGroups.add(DirectionalGroupCoordinates.builder() allGroups.add(DirectionalGroupCoordinates.builder()
.zoneName(zone.getName()) .zoneName(zone.getName())
.recordName(pool.getName()) .recordName(pool.getDName())
.recordType(type.getCode()) .recordType(type.getCode())
.groupName(groupName).build()); .groupName(groupName).build());
} }
@ -109,7 +109,7 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
@Test(dependsOnMethods = "testListGroupNamesByRecordNameAndType") @Test(dependsOnMethods = "testListGroupNamesByRecordNameAndType")
public void testListRecordsByGroupCoordinates() { public void testListRecordsByGroupCoordinates() {
for (DirectionalGroupCoordinates group : allGroups) { for (DirectionalGroupCoordinates group : allGroups) {
for (DirectionalRecordDetail rr : api().listRecordsByGroupCoordinates(group)) { for (DirectionalPoolRecordDetail rr : api().listRecordsByGroupCoordinates(group)) {
DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr); DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr);
} }
} }

View File

@ -28,9 +28,9 @@ import java.util.Set;
import org.jclouds.rest.ResourceNotFoundException; import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.ultradns.ws.domain.DirectionalPool; import org.jclouds.ultradns.ws.domain.DirectionalPool;
import org.jclouds.ultradns.ws.domain.DirectionalRecord; import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
import org.jclouds.ultradns.ws.domain.DirectionalRecordType; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.IdAndName;
import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
@ -69,8 +69,8 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
private void checkDirectional(DirectionalPool pool) { private void checkDirectional(DirectionalPool pool) {
assertNotNull(pool.getZoneId(), "ZoneId cannot be null " + pool); assertNotNull(pool.getZoneId(), "ZoneId cannot be null " + pool);
assertNotNull(pool.getId(), "Id cannot be null " + pool); assertNotNull(pool.getId(), "Id cannot be null " + pool);
assertNotNull(pool.getName(), "DName cannot be null " + pool); assertNotNull(pool.getDName(), "DName cannot be null " + pool);
assertNotNull(pool.getDescription(), "Description cannot be null " + pool); assertNotNull(pool.getName(), "Name cannot be null " + pool);
assertNotNull(pool.getType(), "Type cannot be null " + pool); assertNotNull(pool.getType(), "Type cannot be null " + pool);
assertNotNull(pool.getTieBreak(), "TieBreak cannot be null " + pool); assertNotNull(pool.getTieBreak(), "TieBreak cannot be null " + pool);
} }
@ -81,9 +81,9 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
public void testListDirectionalRecords() { public void testListDirectionalRecords() {
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
for (DirectionalPool pool : api(zone.getName()).list()) { for (DirectionalPool pool : api(zone.getName()).list()) {
for (DirectionalRecordType type : EnumSet.allOf(DirectionalRecordType.class)) { for (RecordType type : EnumSet.allOf(RecordType.class)) {
for (DirectionalRecordDetail rr : api(zone.getName()) for (DirectionalPoolRecordDetail rr : api(zone.getName())
.listRecordsByNameAndType(pool.getName(), type.getCode())) { .listRecordsByNameAndType(pool.getDName(), type.getCode())) {
checkDirectionalRecordDetail(rr); checkDirectionalRecordDetail(rr);
Iterable<IdAndName> groups = Optional.presentInstances(ImmutableSet.of(rr.getGroup(), Iterable<IdAndName> groups = Optional.presentInstances(ImmutableSet.of(rr.getGroup(),
rr.getGeolocationGroup(), rr.getGeolocationGroup())); rr.getGeolocationGroup(), rr.getGeolocationGroup()));
@ -94,7 +94,7 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
assertNotNull(group.getName(), "Name cannot be null " + group); assertNotNull(group.getName(), "Name cannot be null " + group);
} }
assertEquals(rr.getZoneName(), zone.getName()); assertEquals(rr.getZoneName(), zone.getName());
assertEquals(rr.getName(), pool.getName()); assertEquals(rr.getName(), pool.getDName());
switch (pool.getType()) { switch (pool.getType()) {
case GEOLOCATION: case GEOLOCATION:
assertNotNull(rr.getGeolocationGroup().or(rr.getGroup()).orNull(), assertNotNull(rr.getGeolocationGroup().or(rr.getGroup()).orNull(),
@ -116,13 +116,13 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
} }
} }
static void checkDirectionalRecord(DirectionalRecord rr) { static void checkDirectionalRecord(DirectionalPoolRecord rr) {
assertNotNull(rr.getType(), "Type cannot be null " + rr); assertNotNull(rr.getType(), "Type cannot be null " + rr);
assertNotNull(rr.getTTL(), "TTL cannot be null " + rr); assertNotNull(rr.getTTL(), "TTL cannot be null " + rr);
assertNotNull(rr.getRData(), "InfoValues cannot be null " + rr); assertNotNull(rr.getRData(), "InfoValues cannot be null " + rr);
} }
static void checkDirectionalRecordDetail(DirectionalRecordDetail rr) { static void checkDirectionalRecordDetail(DirectionalPoolRecordDetail rr) {
assertNotNull(rr.getZoneName(), "ZoneName cannot be null " + rr); assertNotNull(rr.getZoneName(), "ZoneName cannot be null " + rr);
assertNotNull(rr.getName(), "DName cannot be null " + rr); assertNotNull(rr.getName(), "DName cannot be null " + rr);
assertNotNull(rr.getId(), "Id cannot be null " + rr); assertNotNull(rr.getId(), "Id cannot be null " + rr);

View File

@ -33,7 +33,7 @@ import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.IdAndName;
import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
@ -80,7 +80,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
assertNotNull(rr.getRData(), "InfoValues cannot be null for " + rr); assertNotNull(rr.getRData(), "InfoValues cannot be null for " + rr);
} }
static void checkResourceRecordMetadata(ResourceRecordMetadata rr) { static void checkResourceRecordMetadata(ResourceRecordDetail rr) {
assertNotNull(rr.getZoneId(), "ZoneId cannot be null for " + rr); assertNotNull(rr.getZoneId(), "ZoneId cannot be null for " + rr);
assertNotNull(rr.getGuid(), "Guid cannot be null for " + rr); assertNotNull(rr.getGuid(), "Guid cannot be null for " + rr);
assertNotNull(rr.getZoneName(), "ZoneName cannot be null for " + rr); assertNotNull(rr.getZoneName(), "ZoneName cannot be null for " + rr);
@ -95,7 +95,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
public void testListResourceRecords() { public void testListResourceRecords() {
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
zones.incrementAndGet(); zones.incrementAndGet();
for (ResourceRecordMetadata rr : api(zone.getName()).list()) { for (ResourceRecordDetail rr : api(zone.getName()).list()) {
recordTypeCounts.getUnchecked(rr.getRecord().getType()).incrementAndGet(); recordTypeCounts.getUnchecked(rr.getRecord().getType()).incrementAndGet();
checkResourceRecordMetadata(rr); checkResourceRecordMetadata(rr);
} }
@ -177,8 +177,8 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
assertFalse(listRRs().anyMatch(equalTo(mx))); assertFalse(listRRs().anyMatch(equalTo(mx)));
} }
static Function<ResourceRecordMetadata, ResourceRecord> toRecord = new Function<ResourceRecordMetadata, ResourceRecord>() { static Function<ResourceRecordDetail, ResourceRecord> toRecord = new Function<ResourceRecordDetail, ResourceRecord>() {
public ResourceRecord apply(ResourceRecordMetadata in) { public ResourceRecord apply(ResourceRecordDetail in) {
checkResourceRecordMetadata(in); checkResourceRecordMetadata(in);
return in.getRecord(); return in.getRecord();
} }

View File

@ -52,12 +52,12 @@ public class RoundRobinPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
public void testCreateAWhenResponseIs2xx() { public void testCreateAWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(createA, createResponse); UltraDNSWSApi success = requestSendsResponse(createA, createResponse);
assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForHostname("www.jclouds.org.", "foo"), "060339AA04175655"); assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForDName("www.jclouds.org.", "foo"), "060339AA04175655");
} }
public void testCreateAAAAWhenResponseIs2xx() { public void testCreateAAAAWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(createAAAA, createResponse); UltraDNSWSApi success = requestSendsResponse(createAAAA, createResponse);
assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAAAAPoolForHostname("www.jclouds.org.", "foo"), "060339AA04175655"); assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAAAAPoolForDName("www.jclouds.org.", "foo"), "060339AA04175655");
} }
HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode()) HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
@ -66,7 +66,7 @@ public class RoundRobinPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
@Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.") @Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.")
public void testCreateWhenResponseError2912() { public void testCreateWhenResponseError2912() {
UltraDNSWSApi already = requestSendsResponse(createA, alreadyCreated); UltraDNSWSApi already = requestSendsResponse(createA, alreadyCreated);
already.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForHostname("www.jclouds.org.", "foo"); already.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForDName("www.jclouds.org.", "foo");
} }
HttpRequest list = HttpRequest.builder().method(POST) HttpRequest list = HttpRequest.builder().method(POST)

View File

@ -31,7 +31,7 @@ import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
import org.jclouds.ultradns.ws.domain.IdAndName; import org.jclouds.ultradns.ws.domain.IdAndName;
import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.jclouds.ultradns.ws.domain.RoundRobinPool; import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
@ -81,7 +81,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
public void testListRRPoolRecords() { public void testListRRPoolRecords() {
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
for (RoundRobinPool pool : api(zone.getName()).list()) { for (RoundRobinPool pool : api(zone.getName()).list()) {
for (ResourceRecordMetadata record : api(zone.getName()).listRecords(pool.getId())) { for (ResourceRecordDetail record : api(zone.getName()).listRecords(pool.getId())) {
ResourceRecordApiLiveTest.checkResourceRecordMetadata(record); ResourceRecordApiLiveTest.checkResourceRecordMetadata(record);
} }
} }
@ -98,15 +98,15 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
api(zoneName).delete("06063D9C54C5AE09"); api(zoneName).delete("06063D9C54C5AE09");
} }
String hostname = "www.rrpool." + zoneName; String dname = "www.rrpool." + zoneName;
String aPoolId; String aPoolId;
@Test @Test
public void testCreateAPool() { public void testCreateAPool() {
aPoolId = api(zoneName).createAPoolForHostname("A pool", hostname); aPoolId = api(zoneName).createAPoolForDName("A pool", dname);
getAnonymousLogger().info("created A rr pool: " + aPoolId); getAnonymousLogger().info("created A rr pool: " + aPoolId);
try { try {
api(zoneName).createAPoolForHostname("A pool", hostname); api(zoneName).createAPoolForDName("A pool", dname);
fail(); fail();
} catch (ResourceAlreadyExistsException e) { } catch (ResourceAlreadyExistsException e) {
@ -114,7 +114,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
Optional<RoundRobinPool> aPool = getPoolById(aPoolId); Optional<RoundRobinPool> aPool = getPoolById(aPoolId);
assertTrue(aPool.isPresent()); assertTrue(aPool.isPresent());
assertEquals(aPool.get().getName(), "A pool"); assertEquals(aPool.get().getName(), "A pool");
assertEquals(aPool.get().getDName(), hostname); assertEquals(aPool.get().getDName(), dname);
} }
String aRecord1; String aRecord1;
@ -127,12 +127,12 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
getAnonymousLogger().info("created A record: " + aRecord1); getAnonymousLogger().info("created A record: " + aRecord1);
assertTrue(listRRs(aPoolId).anyMatch( assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type(1).ttl(1).rdata("1.2.3.4").build()))); equalTo(rrBuilder().name(dname).type(1).ttl(1).rdata("1.2.3.4").build())));
aRecord2 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "3.4.5.6", 1); aRecord2 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "3.4.5.6", 1);
assertTrue(listRRs(aPoolId).anyMatch( assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type(1).ttl(1).rdata("3.4.5.6").build()))); equalTo(rrBuilder().name(dname).type(1).ttl(1).rdata("3.4.5.6").build())));
getAnonymousLogger().info("created A record: " + aRecord1); getAnonymousLogger().info("created A record: " + aRecord1);
try { try {
@ -147,17 +147,17 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
public void testUpdateRecord() { public void testUpdateRecord() {
api(zoneName).updateRecordWithAddressAndTTL(aPoolId, aRecord1, "1.1.1.1", 0); api(zoneName).updateRecordWithAddressAndTTL(aPoolId, aRecord1, "1.1.1.1", 0);
assertTrue(listRRs(aPoolId).anyMatch( assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type(1).ttl(0).rdata("1.1.1.1").build()))); equalTo(rrBuilder().name(dname).type(1).ttl(0).rdata("1.1.1.1").build())));
} }
@Test(dependsOnMethods = "testUpdateRecord") @Test(dependsOnMethods = "testUpdateRecord")
public void testDeleteRecord() { public void testDeleteRecord() {
api(zoneName).deleteRecord(aRecord2); api(zoneName).deleteRecord(aRecord2);
assertTrue(listRRs(aPoolId).anyMatch( assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type(1).ttl(0).rdata("1.1.1.1").build()))); equalTo(rrBuilder().name(dname).type(1).ttl(0).rdata("1.1.1.1").build())));
assertFalse(listRRs(aPoolId).anyMatch( assertFalse(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type(1).ttl(1).rdata("3.4.5.6").build()))); equalTo(rrBuilder().name(dname).type(1).ttl(1).rdata("3.4.5.6").build())));
} }
@Test(dependsOnMethods = "testDeleteRecord") @Test(dependsOnMethods = "testDeleteRecord")
@ -170,10 +170,10 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
@Test @Test
public void testCreateAAAAPool() { public void testCreateAAAAPool() {
aaaaPoolId = api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname); aaaaPoolId = api(zoneName).createAAAAPoolForDName("AAAA pool", dname);
getAnonymousLogger().info("created AAAA rr pool: " + aaaaPoolId); getAnonymousLogger().info("created AAAA rr pool: " + aaaaPoolId);
try { try {
api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname); api(zoneName).createAAAAPoolForDName("AAAA pool", dname);
fail(); fail();
} catch (ResourceAlreadyExistsException e) { } catch (ResourceAlreadyExistsException e) {
@ -181,7 +181,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
Optional<RoundRobinPool> aPool = getPoolById(aaaaPoolId); Optional<RoundRobinPool> aPool = getPoolById(aaaaPoolId);
assertTrue(aPool.isPresent()); assertTrue(aPool.isPresent());
assertEquals(aPool.get().getName(), "AAAA pool"); assertEquals(aPool.get().getName(), "AAAA pool");
assertEquals(aPool.get().getDName(), hostname); assertEquals(aPool.get().getDName(), dname);
} }
String aaaaRecord1; String aaaaRecord1;
@ -195,7 +195,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
getAnonymousLogger().info("created AAAA record: " + aaaaRecord1); getAnonymousLogger().info("created AAAA record: " + aaaaRecord1);
assertTrue(listRRs(aaaaPoolId).anyMatch( assertTrue(listRRs(aaaaPoolId).anyMatch(
equalTo(rrBuilder().name(hostname) equalTo(rrBuilder().name(dname)
.type(28) .type(28)
.ttl(1) .ttl(1)
.rdata("2001:0DB8:85A3:0000:0000:8A2E:0370:7334") .rdata("2001:0DB8:85A3:0000:0000:8A2E:0370:7334")
@ -205,7 +205,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
1); 1);
assertTrue(listRRs(aaaaPoolId).anyMatch( assertTrue(listRRs(aaaaPoolId).anyMatch(
equalTo(rrBuilder().name(hostname) equalTo(rrBuilder().name(dname)
.type(28) .type(28)
.ttl(1) .ttl(1)
.rdata("2002:0DB8:85A3:0000:0000:8A2E:0370:7334") .rdata("2002:0DB8:85A3:0000:0000:8A2E:0370:7334")

View File

@ -21,6 +21,7 @@ import static com.google.common.net.HttpHeaders.HOST;
import static javax.ws.rs.HttpMethod.POST; import static javax.ws.rs.HttpMethod.POST;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static javax.ws.rs.core.Response.Status.OK; import static javax.ws.rs.core.Response.Status.OK;
import static org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType.IPV4;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;
@ -50,7 +51,9 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
public void testCreateWhenResponseIs2xx() { public void testCreateWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(create, createResponse); UltraDNSWSApi success = requestSendsResponse(create, createResponse);
assertEquals(success.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForHostname("www.jclouds.org.", "foo"), "060339AA0417567A"); assertEquals(
success.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForDNameAndType("foo",
"www.jclouds.org.", IPV4), "060339AA0417567A");
} }
HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode()) HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
@ -59,7 +62,8 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
@Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.") @Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.")
public void testCreateWhenResponseError2912() { public void testCreateWhenResponseError2912() {
UltraDNSWSApi already = requestSendsResponse(create, alreadyCreated); UltraDNSWSApi already = requestSendsResponse(create, alreadyCreated);
already.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForHostname("www.jclouds.org.", "foo"); already.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForDNameAndType("foo", "www.jclouds.org.",
IPV4);
} }
HttpRequest list = HttpRequest.builder().method(POST) HttpRequest list = HttpRequest.builder().method(POST)
@ -189,7 +193,7 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
} }
UpdatePoolRecord update = UpdatePoolRecord.builder() UpdatePoolRecord update = UpdatePoolRecord.builder()
.pointsTo("www.baz.com.") .rdata("www.baz.com.")
.mode("Normal") .mode("Normal")
.weight(98) .weight(98)
.failOverDelay(0) .failOverDelay(0)

View File

@ -19,6 +19,8 @@
package org.jclouds.ultradns.ws.features; package org.jclouds.ultradns.ws.features;
import static java.util.logging.Logger.getAnonymousLogger; import static java.util.logging.Logger.getAnonymousLogger;
import static org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType.IPV4;
import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status.UNRECOGNIZED;
import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo;
import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -34,7 +36,7 @@ import org.jclouds.ultradns.ws.domain.IdAndName;
import org.jclouds.ultradns.ws.domain.PoolRecordSpec; import org.jclouds.ultradns.ws.domain.PoolRecordSpec;
import org.jclouds.ultradns.ws.domain.TrafficControllerPool; import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail;
import org.jclouds.ultradns.ws.domain.UpdatePoolRecord; import org.jclouds.ultradns.ws.domain.UpdatePoolRecord;
import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest; import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
@ -85,14 +87,14 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
public void testListTCPoolRecords() { public void testListTCPoolRecords() {
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) { for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
for (TrafficControllerPool pool : api(zone.getName()).list()) { for (TrafficControllerPool pool : api(zone.getName()).list()) {
for (TrafficControllerPoolRecord record : api(zone.getName()).listRecords(pool.getId())) { for (TrafficControllerPoolRecordDetail record : api(zone.getName()).listRecords(pool.getId())) {
checkPoolRecordConsistent(zone.getName(), record); checkPoolRecordConsistent(zone.getName(), record);
} }
} }
} }
} }
private TrafficControllerPoolRecord checkPoolRecordConsistent(String zoneName, TrafficControllerPoolRecord record) { private TrafficControllerPoolRecordDetail checkPoolRecordConsistent(String zoneName, TrafficControllerPoolRecordDetail record) {
Optional<TrafficControllerPool> pool = getPoolByZoneAndId(zoneName, record.getPoolId()); Optional<TrafficControllerPool> pool = getPoolByZoneAndId(zoneName, record.getPoolId());
assertTrue(pool.isPresent(), "could not get pool for " + record); assertTrue(pool.isPresent(), "could not get pool for " + record);
assertEquals(record.getDescription(), pool.get().getName()); assertEquals(record.getDescription(), pool.get().getName());
@ -103,15 +105,15 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
return checkTrafficControllerPoolRecord(record); return checkTrafficControllerPoolRecord(record);
} }
static TrafficControllerPoolRecord checkTrafficControllerPoolRecord(TrafficControllerPoolRecord record) { static TrafficControllerPoolRecordDetail checkTrafficControllerPoolRecord(TrafficControllerPoolRecordDetail record) {
assertNotNull(record.getId(), "Id cannot be null for " + record); assertNotNull(record.getId(), "Id cannot be null for " + record);
assertNotNull(record.getPoolId(), "PoolId cannot be null for " + record); assertNotNull(record.getPoolId(), "PoolId cannot be null for " + record);
assertNotNull(record.getPointsTo(), "PointsTo cannot be null for " + record); assertNotNull(record.getRecord().getRData(), "Record.RData cannot be null for " + record);
assertNotNull(record.getRecord().getType(), "Record.Type cannot be null for " + record);
assertTrue(record.getWeight() >= 0, "Weight must be unsigned for " + record); assertTrue(record.getWeight() >= 0, "Weight must be unsigned for " + record);
assertTrue(record.getPriority() >= 0, "Priority must be unsigned for " + record); assertTrue(record.getPriority() >= 0, "Priority must be unsigned for " + record);
assertNotNull(record.getType(), "Type cannot be null for " + record);
assertNotNull(record.getStatus(), "Status cannot be null for " + record); assertNotNull(record.getStatus(), "Status cannot be null for " + record);
assertTrue(record.getStatus() != Status.UNRECOGNIZED, "unrecognized status for " + record); assertTrue(record.getStatus() != UNRECOGNIZED, "unrecognized status for " + record);
assertNotNull(record.getDescription(), "Description cannot be null for " + record); assertNotNull(record.getDescription(), "Description cannot be null for " + record);
return record; return record;
} }
@ -156,25 +158,25 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Pool Record does not exist.") @Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Pool Record does not exist.")
public void testUpdateRecordWhenNotFound() { public void testUpdateRecordWhenNotFound() {
api(zoneName).updateRecord("06063D9C54C5AE09", api(zoneName).updateRecord("06063D9C54C5AE09",
UpdatePoolRecord.builder().pointsTo("www.foo.com.").mode("Normal").build()); UpdatePoolRecord.builder().rdata("www.foo.com.").mode("Normal").build());
} }
String hostname = "www.tcpool." + zoneName; String dname = "www.tcpool." + zoneName;
String poolId; String poolId;
@Test @Test
public void testCreatePool() { public void testCreatePool() {
poolId = api(zoneName).createPoolForHostname("pool", hostname); poolId = api(zoneName).createPoolForDNameAndType("pool", dname, IPV4);
getAnonymousLogger().info("created tc pool: " + poolId); getAnonymousLogger().info("created tc pool: " + poolId);
try { try {
api(zoneName).createPoolForHostname("pool", hostname); api(zoneName).createPoolForDNameAndType("pool", dname, IPV4);
fail(); fail();
} catch (ResourceAlreadyExistsException e) { } catch (ResourceAlreadyExistsException e) {
} }
// ensure there's only one pool for a hostname // ensure there's only one pool for a dname
try { try {
api(zoneName).createPoolForHostname("pool1", hostname); api(zoneName).createPoolForDNameAndType("pool1", dname, IPV4);
fail(); fail();
} catch (ResourceAlreadyExistsException e) { } catch (ResourceAlreadyExistsException e) {
@ -183,7 +185,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
assertTrue(pool.isPresent()); assertTrue(pool.isPresent());
assertEquals(pool.get().getId(), poolId); assertEquals(pool.get().getId(), poolId);
assertEquals(pool.get().getName(), "pool"); assertEquals(pool.get().getName(), "pool");
assertEquals(pool.get().getDName(), hostname); assertEquals(pool.get().getDName(), dname);
checkTCPool(pool.get()); checkTCPool(pool.get());
} }
@ -202,18 +204,17 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
} }
@Test(dependsOnMethods = "testCreatePool", dataProvider = "records") @Test(dependsOnMethods = "testCreatePool", dataProvider = "records")
public TrafficControllerPoolRecord addRecordToPool(String pointsTo, String type, int ttl, Optional<Integer> weight) { public TrafficControllerPoolRecordDetail addRecordToPool(String rdata, String type, int ttl, Optional<Integer> weight) {
String recordId; String recordId;
if (weight.isPresent()) { if (weight.isPresent()) {
recordId = api(zoneName).addRecordToPoolWithTTLAndWeight(pointsTo, poolId, ttl, weight.get()); recordId = api(zoneName).addRecordToPoolWithTTLAndWeight(rdata, poolId, ttl, weight.get());
} else { } else {
recordId = api(zoneName).addRecordToPoolWithTTL(pointsTo, poolId, ttl); recordId = api(zoneName).addRecordToPoolWithTTL(rdata, poolId, ttl);
} }
getAnonymousLogger().info("created " + type + " record: " + recordId); getAnonymousLogger().info("created " + type + " record: " + recordId);
TrafficControllerPoolRecord record = checkPoolRecordConsistent(zoneName, getRecordById(recordId).get()); TrafficControllerPoolRecordDetail record = checkPoolRecordConsistent(zoneName, getRecordById(recordId).get());
PoolRecordSpec recordSpec = checkPoolRecordSpec(api(zoneName).getRecordSpec(recordId)); PoolRecordSpec recordSpec = checkPoolRecordSpec(api(zoneName).getRecordSpec(recordId));
assertEquals(record.getPointsTo(), pointsTo); assertEquals(record.getRecord(), TrafficControllerPoolRecord.create(type, rdata));
assertEquals(record.getType(), type);
assertEquals(record.getWeight(), weight.or(2).intValue()); assertEquals(record.getWeight(), weight.or(2).intValue());
assertEquals(recordSpec.getTTL(), ttl); assertEquals(recordSpec.getTTL(), ttl);
return record; return record;
@ -240,14 +241,14 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
public void testUpdateRecord() { public void testUpdateRecord() {
PoolRecordSpec spec = api(zoneName).getRecordSpec(cname2); PoolRecordSpec spec = api(zoneName).getRecordSpec(cname2);
UpdatePoolRecord update = UpdatePoolRecord.builder().from(spec) UpdatePoolRecord update = UpdatePoolRecord.builder().from(spec)
.pointsTo("www.baz.com.") .rdata("www.baz.com.")
.weight(98) .weight(98)
.ttl(200).build(); .ttl(200).build();
api(zoneName).updateRecord(cname2, update); api(zoneName).updateRecord(cname2, update);
TrafficControllerPoolRecord record = getRecordById(cname2).get(); TrafficControllerPoolRecordDetail record = getRecordById(cname2).get();
assertEquals(record.getPointsTo(), "www.baz.com."); assertEquals(record.getRecord().getRData(), "www.baz.com.");
spec = api(zoneName).getRecordSpec(cname2); spec = api(zoneName).getRecordSpec(cname2);
assertEquals(spec.getWeight(), 98); assertEquals(spec.getWeight(), 98);
@ -267,7 +268,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
assertFalse(getPoolByZoneAndId(zoneName, poolId).isPresent()); assertFalse(getPoolByZoneAndId(zoneName, poolId).isPresent());
} }
private Optional<TrafficControllerPoolRecord> getRecordById(String recordId) { private Optional<TrafficControllerPoolRecordDetail> getRecordById(String recordId) {
return api(zoneName).listRecords(poolId).firstMatch(recordIdEqualTo(recordId)); return api(zoneName).listRecords(poolId).firstMatch(recordIdEqualTo(recordId));
} }

View File

@ -45,7 +45,7 @@ public class GetAccountsListOfUserResponseTest extends BaseHandlerTest {
} }
public IdAndName expected() { public IdAndName expected() {
return IdAndName.fromIdAndName("AAAAAAAAAAAAAAAA", "jclouds"); return IdAndName.create("AAAAAAAAAAAAAAAA", "jclouds");
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
package org.jclouds.ultradns.ws.parse; package org.jclouds.ultradns.ws.parse;
import static org.jclouds.ultradns.ws.domain.IdAndName.fromIdAndName; import static org.jclouds.ultradns.ws.domain.IdAndName.create;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.InputStream; import java.io.InputStream;
@ -51,8 +51,8 @@ public class GetAvailableRegionsResponseTest extends BaseHandlerTest {
public Multimap<IdAndName, String> expected() { public Multimap<IdAndName, String> expected() {
return ImmutableMultimap.<IdAndName, String> builder() return ImmutableMultimap.<IdAndName, String> builder()
.put(fromIdAndName("14", "Anonymous Proxy (A1)"), "Anonymous Proxy") .put(create("14", "Anonymous Proxy (A1)"), "Anonymous Proxy")
.putAll(fromIdAndName("3", "Antarctica"), ImmutableSet.<String> builder() .putAll(create("3", "Antarctica"), ImmutableSet.<String> builder()
.add("Antarctica") .add("Antarctica")
.add("Bouvet Island") .add("Bouvet Island")
.add("French Southern Territories") .add("French Southern Territories")

View File

@ -24,7 +24,7 @@ import java.io.InputStream;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.ultradns.ws.domain.DirectionalGroup; import org.jclouds.ultradns.ws.domain.DirectionalGroup;
import org.jclouds.ultradns.ws.xml.DirectionalGroupNameAndRegionsHandler; import org.jclouds.ultradns.ws.xml.DirectionalGroupHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -40,7 +40,7 @@ public class GetDirectionalDNSGroupDetailsResponseTest extends BaseHandlerTest {
DirectionalGroup expected = expected(); DirectionalGroup expected = expected();
DirectionalGroupNameAndRegionsHandler handler = injector.getInstance(DirectionalGroupNameAndRegionsHandler.class); DirectionalGroupHandler handler = injector.getInstance(DirectionalGroupHandler.class);
DirectionalGroup result = factory.create(handler).parse(is); DirectionalGroup result = factory.create(handler).parse(is);
assertEquals(result.toString(), expected.toString()); assertEquals(result.toString(), expected.toString());
@ -52,8 +52,9 @@ public class GetDirectionalDNSGroupDetailsResponseTest extends BaseHandlerTest {
.mapRegionToTerritory("Anonymous Proxy (A1)", "Anonymous Proxy") .mapRegionToTerritory("Anonymous Proxy (A1)", "Anonymous Proxy")
.mapRegionToTerritory("Mexico", "Mexico") .mapRegionToTerritory("Mexico", "Mexico")
.mapRegionToTerritories("Antarctica", ImmutableList.<String> builder() .mapRegionToTerritories("Antarctica", ImmutableList.<String> builder()
.add("Antarctica")
.add("Bouvet Island") .add("Bouvet Island")
.add("French Southern Territories") .add("French Southern Territories")
.add("Antarctica").build()).build(); .build()).build();
} }
} }

View File

@ -18,15 +18,15 @@
*/ */
package org.jclouds.ultradns.ws.parse; package org.jclouds.ultradns.ws.parse;
import static org.jclouds.ultradns.ws.domain.IdAndName.fromIdAndName; import static org.jclouds.ultradns.ws.domain.IdAndName.create;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.InputStream; import java.io.InputStream;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.ultradns.ws.domain.DirectionalRecord; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail; import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler; import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -41,52 +41,52 @@ public class GetDirectionalDNSRecordsForHostResponseTest extends BaseHandlerTest
public void test() { public void test() {
InputStream is = getClass().getResourceAsStream("/directionalrecords.xml"); InputStream is = getClass().getResourceAsStream("/directionalrecords.xml");
FluentIterable<DirectionalRecordDetail> expected = expected(); FluentIterable<DirectionalPoolRecordDetail> expected = expected();
DirectionalRecordDetailListHandler handler = injector.getInstance(DirectionalRecordDetailListHandler.class); DirectionalPoolRecordDetailListHandler handler = injector.getInstance(DirectionalPoolRecordDetailListHandler.class);
FluentIterable<DirectionalRecordDetail> result = factory.create(handler).parse(is); FluentIterable<DirectionalPoolRecordDetail> result = factory.create(handler).parse(is);
assertEquals(result.toSet().toString(), expected.toSet().toString()); assertEquals(result.toSet().toString(), expected.toSet().toString());
} }
public FluentIterable<DirectionalRecordDetail> expected() { public FluentIterable<DirectionalPoolRecordDetail> expected() {
return FluentIterable.from(ImmutableSet.<DirectionalRecordDetail> builder() return FluentIterable.from(ImmutableSet.<DirectionalPoolRecordDetail> builder()
.add(DirectionalRecordDetail.builder() .add(DirectionalPoolRecordDetail.builder()
.zoneName("geo.jclouds.org.") .zoneName("geo.jclouds.org.")
.name("www.geo.jclouds.org.") .name("www.geo.jclouds.org.")
.id("A000000000000001") .id("A000000000000001")
.geolocationGroup(fromIdAndName("C000000000000001", "southamerica")) .geolocationGroup(create("C000000000000001", "southamerica"))
.record(DirectionalRecord.drBuilder() .record(DirectionalPoolRecord.drBuilder()
.type("CNAME") .type("CNAME")
.ttl(300) .ttl(300)
.noResponseRecord(false) .noResponseRecord(false)
.rdata("southamerica.geo.jclouds.org.").build()).build()) .rdata("southamerica.geo.jclouds.org.").build()).build())
.add(DirectionalRecordDetail.builder() .add(DirectionalPoolRecordDetail.builder()
.zoneName("geo.jclouds.org.") .zoneName("geo.jclouds.org.")
.name("www.geo.jclouds.org.") .name("www.geo.jclouds.org.")
.id("A000000000000002") .id("A000000000000002")
.group(fromIdAndName("B000000000000001", "All Non-Configured Regions")) .group(create("B000000000000001", "All Non-Configured Regions"))
.record(DirectionalRecord.drBuilder() .record(DirectionalPoolRecord.drBuilder()
.type("A") .type("A")
.ttl(500) .ttl(500)
.noResponseRecord(false) .noResponseRecord(false)
.rdata("1.1.1.2").build()).build()) .rdata("1.1.1.2").build()).build())
.add(DirectionalRecordDetail.builder() .add(DirectionalPoolRecordDetail.builder()
.zoneName("geo.jclouds.org.") .zoneName("geo.jclouds.org.")
.name("www.geo.jclouds.org.") .name("www.geo.jclouds.org.")
.id("A000000000000003") .id("A000000000000003")
.geolocationGroup(fromIdAndName("C000000000000002", "antarctica-unsupported")) .geolocationGroup(create("C000000000000002", "antarctica-unsupported"))
.record(DirectionalRecord.drBuilder() .record(DirectionalPoolRecord.drBuilder()
.type("A") .type("A")
.ttl(0) .ttl(0)
.noResponseRecord(true) .noResponseRecord(true)
.rdata("No Data Response").build()).build()) .rdata("No Data Response").build()).build())
.add(DirectionalRecordDetail.builder() .add(DirectionalPoolRecordDetail.builder()
.zoneName("geo.jclouds.org.") .zoneName("geo.jclouds.org.")
.name("www.geo.jclouds.org.") .name("www.geo.jclouds.org.")
.id("A000000000000004") .id("A000000000000004")
.geolocationGroup(fromIdAndName("C000000000000003", "alazona")) .geolocationGroup(create("C000000000000003", "alazona"))
.record(DirectionalRecord.drBuilder() .record(DirectionalPoolRecord.drBuilder()
.type("A") .type("A")
.ttl(86400) // default .ttl(86400) // default
.noResponseRecord(false) .noResponseRecord(false)

View File

@ -54,13 +54,13 @@ public class GetDirectionalPoolsByZoneResponseTest extends BaseHandlerTest {
.add(DirectionalPool.builder() .add(DirectionalPool.builder()
.zoneId("0000000000000001") .zoneId("0000000000000001")
.id("000000000000000A") .id("000000000000000A")
.name("mixy.jclouds.org.") .dname("mixy.jclouds.org.")
.type(Type.MIXED) .type(Type.MIXED)
.tieBreak(TieBreak.GEOLOCATION) .tieBreak(TieBreak.GEOLOCATION)
.description("mixy").build()) .name("mixy").build())
.add(DirectionalPool.builder() .add(DirectionalPool.builder()
.zoneId("0000000000000002") .zoneId("0000000000000002")
.id("000000000000000B") .id("000000000000000B")
.name("geo.jclouds.org.").build()).build()); .dname("geo.jclouds.org.").build()).build());
} }
} }

View File

@ -52,17 +52,17 @@ public class GetRRLoadBalancingPoolsByZoneResponseTest extends BaseHandlerTest {
.add(RoundRobinPool.builder() .add(RoundRobinPool.builder()
.zoneId("0000000000000001") .zoneId("0000000000000001")
.id("000000000000002") .id("000000000000002")
.name("app-uswest1.jclouds.org.") .name("uswest1")
.dname("app-uswest1.jclouds.org.").build()) .dname("app-uswest1.jclouds.org.").build())
.add(RoundRobinPool.builder() .add(RoundRobinPool.builder()
.zoneId("0000000000000001") .zoneId("0000000000000001")
.id("000000000000003") .id("000000000000003")
.name("app-uswest2.jclouds.org.") .name("uswest2")
.dname("app-uswest2.jclouds.org.").build()) .dname("app-uswest2.jclouds.org.").build())
.add(RoundRobinPool.builder() .add(RoundRobinPool.builder()
.zoneId("0000000000000001") .zoneId("0000000000000001")
.id("000000000000004") .id("000000000000004")
.name("app-euwest.jclouds.org.") .name("euwest")
.dname("app-euwest.jclouds.org.").build()).build()); .dname("app-euwest.jclouds.org.").build()).build());
} }
} }

View File

@ -25,7 +25,7 @@ import java.io.InputStream;
import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -43,16 +43,16 @@ public class GetResourceRecordsOfDNameByTypeResponseTest extends BaseHandlerTest
public void test() { public void test() {
InputStream is = getClass().getResourceAsStream("/records_by_name_and_type.xml"); InputStream is = getClass().getResourceAsStream("/records_by_name_and_type.xml");
FluentIterable<ResourceRecordMetadata> expected = expected(); FluentIterable<ResourceRecordDetail> expected = expected();
ResourceRecordListHandler handler = injector.getInstance(ResourceRecordListHandler.class); ResourceRecordListHandler handler = injector.getInstance(ResourceRecordListHandler.class);
FluentIterable<ResourceRecordMetadata> result = factory.create(handler).parse(is); FluentIterable<ResourceRecordDetail> result = factory.create(handler).parse(is);
assertEquals(result.toList().toString(), expected.toList().toString()); assertEquals(result.toList().toString(), expected.toList().toString());
} }
public FluentIterable<ResourceRecordMetadata> expected() { public FluentIterable<ResourceRecordDetail> expected() {
ResourceRecordMetadata record = ResourceRecordMetadata.builder() ResourceRecordDetail record = ResourceRecordDetail.builder()
.zoneId("03053D8E57C7A22A") .zoneId("03053D8E57C7A22A")
.guid("04053D8E57C7A22F") .guid("04053D8E57C7A22F")
.zoneName("adrianc.rr.ultradnstest.jclouds.org.") .zoneName("adrianc.rr.ultradnstest.jclouds.org.")

View File

@ -25,8 +25,8 @@ import java.io.InputStream;
import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata.Builder; import org.jclouds.ultradns.ws.domain.ResourceRecordDetail.Builder;
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -45,17 +45,17 @@ public class GetResourceRecordsOfResourceRecordResponseTest extends BaseHandlerT
public void test() { public void test() {
InputStream is = getClass().getResourceAsStream("/records.xml"); InputStream is = getClass().getResourceAsStream("/records.xml");
FluentIterable<ResourceRecordMetadata> expected = expected(); FluentIterable<ResourceRecordDetail> expected = expected();
ResourceRecordListHandler handler = injector.getInstance(ResourceRecordListHandler.class); ResourceRecordListHandler handler = injector.getInstance(ResourceRecordListHandler.class);
FluentIterable<ResourceRecordMetadata> result = factory.create(handler).parse(is); FluentIterable<ResourceRecordDetail> result = factory.create(handler).parse(is);
assertEquals(result.toList().toString(), expected.toList().toString()); assertEquals(result.toList().toString(), expected.toList().toString());
} }
public FluentIterable<ResourceRecordMetadata> expected() { public FluentIterable<ResourceRecordDetail> expected() {
Builder builder = ResourceRecordMetadata.builder().zoneId("0000000000000001").zoneName("jclouds.org."); Builder builder = ResourceRecordDetail.builder().zoneId("0000000000000001").zoneName("jclouds.org.");
ImmutableList<ResourceRecordMetadata> records = ImmutableList.<ResourceRecordMetadata> builder() ImmutableList<ResourceRecordDetail> records = ImmutableList.<ResourceRecordDetail> builder()
.add(builder.guid("04023A2507B6468F") .add(builder.guid("04023A2507B6468F")
.created(dateService.iso8601DateParse("2010-10-02T16:57:16.000Z")) .created(dateService.iso8601DateParse("2010-10-02T16:57:16.000Z"))
.modified(dateService.iso8601DateParse("2011-09-27T23:49:21.000Z")) .modified(dateService.iso8601DateParse("2011-09-27T23:49:21.000Z"))

View File

@ -52,7 +52,7 @@ public class GetTCLoadBalancingPoolsByZoneResponseTest extends BaseHandlerTest {
.add(TrafficControllerPool.builder() .add(TrafficControllerPool.builder()
.zoneId("0000000000000001") .zoneId("0000000000000001")
.id("000000000000002") .id("000000000000002")
.name("us-west-1c.discovery.jclouds.org.") .name("us-west-1c")
.dname("us-west-1c.discovery.jclouds.org.") .dname("us-west-1c.discovery.jclouds.org.")
.statusCode(1) .statusCode(1)
.failOverEnabled(true) .failOverEnabled(true)

View File

@ -18,14 +18,15 @@
*/ */
package org.jclouds.ultradns.ws.parse; package org.jclouds.ultradns.ws.parse;
import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.createCNAME;
import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status.OK;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.InputStream; import java.io.InputStream;
import org.jclouds.http.functions.BaseHandlerTest; import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordDetailListHandler;
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
@ -40,38 +41,36 @@ public class GetTCPoolRecordsResponseTest extends BaseHandlerTest {
public void test() { public void test() {
InputStream is = getClass().getResourceAsStream("/tcrecords.xml"); InputStream is = getClass().getResourceAsStream("/tcrecords.xml");
FluentIterable<TrafficControllerPoolRecord> expected = expected(); FluentIterable<TrafficControllerPoolRecordDetail> expected = expected();
TrafficControllerPoolRecordListHandler handler = injector.getInstance(TrafficControllerPoolRecordListHandler.class); TrafficControllerPoolRecordDetailListHandler handler = injector.getInstance(TrafficControllerPoolRecordDetailListHandler.class);
FluentIterable<TrafficControllerPoolRecord> result = factory.create(handler).parse(is); FluentIterable<TrafficControllerPoolRecordDetail> result = factory.create(handler).parse(is);
assertEquals(result.toSet().toString(), expected.toSet().toString()); assertEquals(result.toSet().toString(), expected.toSet().toString());
} }
public FluentIterable<TrafficControllerPoolRecord> expected() { public FluentIterable<TrafficControllerPoolRecordDetail> expected() {
return FluentIterable.from(ImmutableSet.<TrafficControllerPoolRecord> builder() return FluentIterable.from(ImmutableSet.<TrafficControllerPoolRecordDetail> builder()
.add(TrafficControllerPoolRecord.builder() .add(TrafficControllerPoolRecordDetail.builder()
.id("0000000000000001") .id("0000000000000001")
.poolId("0000000000000001") .poolId("0000000000000001")
.pointsTo("canary.jclouds.org.") .record(createCNAME("canary.jclouds.org."))
.weight(2) .weight(2)
.priority(2) .priority(2)
.type("CNAME")
.forceAnswer("Normal") .forceAnswer("Normal")
.probingEnabled(true) .probingEnabled(true)
.status(Status.OK) .status(OK)
.serving(true) .serving(true)
.description("canary app").build()) .description("canary app").build())
.add(TrafficControllerPoolRecord.builder() .add(TrafficControllerPoolRecordDetail.builder()
.id("0000000000000002") .id("0000000000000002")
.poolId("0000000000000001") .poolId("0000000000000001")
.pointsTo("prod.jclouds.org.") .record(createCNAME("prod.jclouds.org."))
.weight(98) .weight(98)
.priority(1) .priority(1)
.type("CNAME")
.forceAnswer("Normal") .forceAnswer("Normal")
.probingEnabled(true) .probingEnabled(true)
.status(Status.OK) .status(OK)
.serving(true) .serving(true)
.description("prod app").build()) .description("prod app").build())
.build()); .build());

View File

@ -0,0 +1,77 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.ultradns.ws.predicates;
import static org.jclouds.ultradns.ws.domain.IdAndName.create;
import static org.jclouds.ultradns.ws.predicates.DirectionalPoolPredicates.idEqualTo;
import static org.jclouds.ultradns.ws.predicates.DirectionalPoolPredicates.recordIdEqualTo;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import org.jclouds.ultradns.ws.domain.DirectionalPool;
import org.jclouds.ultradns.ws.domain.DirectionalPool.TieBreak;
import org.jclouds.ultradns.ws.domain.DirectionalPool.Type;
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "DirectionalPoolPredicatesTest")
public class DirectionalPoolPredicatesTest {
DirectionalPool pool = DirectionalPool.builder()
.zoneId("0000000000000001")
.id("000000000000000A")
.dname("mixy.jclouds.org.")
.type(Type.MIXED)
.tieBreak(TieBreak.GEOLOCATION)
.name("mixy").build();
@Test
public void testIdEqualToWhenEqual() {
assertTrue(idEqualTo("000000000000000A").apply(pool));
}
@Test
public void testIdEqualToWhenNotEqual() {
assertFalse(idEqualTo("000000000000000B").apply(pool));
}
DirectionalPoolRecordDetail record = DirectionalPoolRecordDetail.builder()
.zoneName("geo.jclouds.org.")
.name("www.geo.jclouds.org.")
.id("A000000000000001")
.geolocationGroup(create("C000000000000001", "southamerica"))
.record(DirectionalPoolRecord.drBuilder()
.type("CNAME")
.ttl(300)
.noResponseRecord(false)
.rdata("southamerica.geo.jclouds.org.").build()).build();
@Test
public void testRecordIdEqualToWhenEqual() {
assertTrue(recordIdEqualTo("A000000000000001").apply(record));
}
@Test
public void testRecordIdEqualToWhenNotEqual() {
assertFalse(recordIdEqualTo("A000000000000002").apply(record));
}
}

View File

@ -18,14 +18,15 @@
*/ */
package org.jclouds.ultradns.ws.predicates; package org.jclouds.ultradns.ws.predicates;
import static org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.createCNAME;
import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.idEqualTo;
import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo; import static org.jclouds.ultradns.ws.predicates.TrafficControllerPoolPredicates.recordIdEqualTo;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import org.jclouds.ultradns.ws.domain.TrafficControllerPool; import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail;
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail.Status;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@ -53,13 +54,12 @@ public class TrafficControllerPoolPredicatesTest {
assertFalse(idEqualTo("000000000000003").apply(pool)); assertFalse(idEqualTo("000000000000003").apply(pool));
} }
TrafficControllerPoolRecord record = TrafficControllerPoolRecord.builder() TrafficControllerPoolRecordDetail record = TrafficControllerPoolRecordDetail.builder()
.id("0000000000000001") .id("0000000000000001")
.poolId("0000000000000001") .poolId("0000000000000001")
.pointsTo("canary.jclouds.org.") .record(createCNAME("canary.jclouds.org."))
.weight(2) .weight(2)
.priority(2) .priority(2)
.type("CNAME")
.forceAnswer("Normal") .forceAnswer("Normal")
.probingEnabled(true) .probingEnabled(true)
.status(Status.OK) .status(Status.OK)

View File

@ -1 +1 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:addTCLBPool><transactionID /><zoneName>jclouds.org.</zoneName><hostName>foo</hostName><description>www.jclouds.org.</description><poolRecordType>1</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool></soapenv:Body></soapenv:Envelope> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:addTCLBPool><transactionID /><zoneName>jclouds.org.</zoneName><hostName>www.jclouds.org.</hostName><description>foo</description><poolRecordType>1</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool></soapenv:Body></soapenv:Envelope>

View File

@ -4,17 +4,17 @@
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/"> xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
<LBPoolList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/"> <LBPoolList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
<ns2:LBPoolData zoneid="0000000000000001"> <ns2:LBPoolData zoneid="0000000000000001">
<ns2:PoolData PoolName="app-uswest1.jclouds.org." <ns2:PoolData description="uswest1"
PoolId="000000000000002" PoolType="RD" PoolDName="app-uswest1.jclouds.org." PoolId="000000000000002" PoolType="RD" PoolDName="app-uswest1.jclouds.org."
ResponseMethod="RR" /> ResponseMethod="RR" />
</ns2:LBPoolData> </ns2:LBPoolData>
<ns2:LBPoolData zoneid="0000000000000001"> <ns2:LBPoolData zoneid="0000000000000001">
<ns2:PoolData PoolName="app-uswest2.jclouds.org." <ns2:PoolData description="uswest2"
PoolId="000000000000003" PoolType="RD" PoolDName="app-uswest2.jclouds.org." PoolId="000000000000003" PoolType="RD" PoolDName="app-uswest2.jclouds.org."
ResponseMethod="RR" /> ResponseMethod="RR" />
</ns2:LBPoolData> </ns2:LBPoolData>
<ns2:LBPoolData zoneid="0000000000000001"> <ns2:LBPoolData zoneid="0000000000000001">
<ns2:PoolData PoolName="app-euwest.jclouds.org." <ns2:PoolData description="euwest"
PoolId="000000000000004" PoolType="RD" PoolDName="app-euwest.jclouds.org." PoolId="000000000000004" PoolType="RD" PoolDName="app-euwest.jclouds.org."
ResponseMethod="RR" /> ResponseMethod="RR" />
</ns2:LBPoolData> </ns2:LBPoolData>

View File

@ -4,7 +4,7 @@
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/"> xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
<LBPoolList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/"> <LBPoolList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
<ns2:LBPoolData zoneid="0000000000000001"> <ns2:LBPoolData zoneid="0000000000000001">
<ns2:PoolData PoolName="us-west-1c.discovery.jclouds.org." <ns2:PoolData description="us-west-1c"
PoolId="000000000000002" PoolType="TC" PoolStatus="1" PoolId="000000000000002" PoolType="TC" PoolStatus="1"
PoolDName="us-west-1c.discovery.jclouds.org." FailOver="Enabled" PoolDName="us-west-1c.discovery.jclouds.org." FailOver="Enabled"
Probing="Enabled" MaxActiveServers="0" /> Probing="Enabled" MaxActiveServers="0" />