mirror of https://github.com/apache/jclouds.git
cleanup naming convention differences across ultradns apis
This commit is contained in:
parent
cee3daea80
commit
8773cda5c7
|
@ -69,7 +69,7 @@ public interface UltraDNSWSApi extends Closeable {
|
|||
@POST
|
||||
@XMLResponseParser(RegionListHandler.class)
|
||||
@Payload("<v01:getAvailableRegions/>")
|
||||
Multimap<IdAndName, String> getRegionsById();
|
||||
Multimap<IdAndName, String> getRegionsByIdAndName();
|
||||
|
||||
/**
|
||||
* Provides access to Zone features.
|
||||
|
|
|
@ -43,7 +43,7 @@ public class UpdatePoolRecordToXML implements MapBinder {
|
|||
|
||||
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("<failOverDelay>").append(update.getFailOverDelay()).append("</failOverDelay>");
|
||||
xml.append("<ttl>").append(update.getTTL()).append("</ttl>");
|
||||
|
|
|
@ -134,6 +134,16 @@ public class DirectionalGroup extends ForwardingMultimap<String, String> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds to current regionToTerritories
|
||||
*
|
||||
* @see DirectionalGroup#getRegionToTerritories()
|
||||
*/
|
||||
public Builder mapRegion(String region) {
|
||||
this.regionToTerritories.put(region, "all");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* replaces current regionToTerritories
|
||||
*
|
||||
|
|
|
@ -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() {
|
||||
return zoneName;
|
||||
}
|
||||
|
||||
/**
|
||||
* the {@link DirectionalRecordDetail#getName() dname} of the record.
|
||||
* the {@link DirectionalPoolRecordDetail#getName() dname} of the record.
|
||||
*/
|
||||
public String getRecordName() {
|
||||
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() {
|
||||
return recordType;
|
||||
|
@ -69,9 +69,9 @@ public class DirectionalGroupCoordinates {
|
|||
/**
|
||||
* the {@link DirectionalGroup#getName() name} of the directional group.
|
||||
*
|
||||
* @see DirectionalRecordDetail#getGroup()
|
||||
* @see DirectionalRecordDetail#getGeolocationGroup()
|
||||
* @see DirectionalRecordDetail#getSourceIpGroup()
|
||||
* @see DirectionalPoolRecordDetail#getGroup()
|
||||
* @see DirectionalPoolRecordDetail#getGeolocationGroup()
|
||||
* @see DirectionalPoolRecordDetail#getSourceIpGroup()
|
||||
*/
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
|
|
|
@ -32,16 +32,16 @@ public final class DirectionalPool {
|
|||
|
||||
private final String zoneId;
|
||||
private final String id;
|
||||
private final Optional<String> description;
|
||||
private final Optional<String> name;
|
||||
private final String dname;
|
||||
private final Type type;
|
||||
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) {
|
||||
this.zoneId = checkNotNull(zoneId, "zoneId");
|
||||
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.type = type;
|
||||
this.tieBreak = tieBreak;
|
||||
|
@ -58,15 +58,15 @@ public final class DirectionalPool {
|
|||
/**
|
||||
* The dname of the pool. ex. {@code jclouds.org.}
|
||||
*/
|
||||
public String getName() {
|
||||
public String getDName() {
|
||||
return dname;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description of the pool. ex. {@code My Pool}
|
||||
* The name of the pool. ex. {@code My Pool}
|
||||
*/
|
||||
public Optional<String> getDescription() {
|
||||
return description;
|
||||
public Optional<String> getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
|
@ -86,13 +86,66 @@ public final class DirectionalPool {
|
|||
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 {
|
||||
GEOLOCATION, SOURCEIP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(zoneId, id, description, dname);
|
||||
return Objects.hashCode(zoneId, id, name, dname);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -105,13 +158,13 @@ public final class DirectionalPool {
|
|||
return false;
|
||||
DirectionalPool that = DirectionalPool.class.cast(obj);
|
||||
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
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).omitNullValues().add("zoneId", zoneId).add("id", id).add("name", dname)
|
||||
.add("description", description.orNull()).add("type", type).add("tieBreak", tieBreak).toString();
|
||||
return Objects.toStringHelper(this).omitNullValues().add("zoneId", zoneId).add("id", id).add("dname", dname)
|
||||
.add("name", name.orNull()).add("type", type).add("tieBreak", tieBreak).toString();
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
|
@ -125,7 +178,7 @@ public final class DirectionalPool {
|
|||
public final static class Builder {
|
||||
private String zoneId;
|
||||
private String id;
|
||||
private Optional<String> description = Optional.absent();
|
||||
private Optional<String> name = Optional.absent();
|
||||
private String dname;
|
||||
private Type type = Type.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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalPool#getDescription()
|
||||
* @see DirectionalPool#getName()
|
||||
*/
|
||||
public Builder description(String description) {
|
||||
this.description = Optional.fromNullable(description);
|
||||
public Builder name(String name) {
|
||||
this.name = Optional.fromNullable(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -179,11 +232,11 @@ public final class DirectionalPool {
|
|||
}
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,13 +33,13 @@ import com.google.common.collect.ImmutableList;
|
|||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class DirectionalRecord {
|
||||
public class DirectionalPoolRecord {
|
||||
private final String type;
|
||||
private final int ttl;
|
||||
private final boolean noResponseRecord;
|
||||
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");
|
||||
checkArgument(ttl >= 0, "ttl must be >= 0");
|
||||
this.ttl = ttl;
|
||||
|
@ -84,7 +84,7 @@ public class DirectionalRecord {
|
|||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
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)
|
||||
&& 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();
|
||||
|
||||
/**
|
||||
* @see DirectionalRecord#getType()
|
||||
* @see DirectionalPoolRecord#getType()
|
||||
*/
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
|
@ -118,7 +118,7 @@ public class DirectionalRecord {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecord#getTTL()
|
||||
* @see DirectionalPoolRecord#getTTL()
|
||||
*/
|
||||
public Builder ttl(int ttl) {
|
||||
this.ttl = ttl;
|
||||
|
@ -126,7 +126,7 @@ public class DirectionalRecord {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecord#isNoResponseRecord()
|
||||
* @see DirectionalPoolRecord#isNoResponseRecord()
|
||||
*/
|
||||
public Builder noResponseRecord(boolean noResponseRecord) {
|
||||
this.noResponseRecord = noResponseRecord;
|
||||
|
@ -136,7 +136,7 @@ public class DirectionalRecord {
|
|||
/**
|
||||
* adds to current values
|
||||
*
|
||||
* @see DirectionalRecord#getRData()
|
||||
* @see DirectionalPoolRecord#getRData()
|
||||
*/
|
||||
public Builder infoValue(Object infoValue) {
|
||||
this.infoValues.add(infoValue.toString());
|
||||
|
@ -146,7 +146,7 @@ public class DirectionalRecord {
|
|||
/**
|
||||
* replaces current values
|
||||
*
|
||||
* @see DirectionalRecord#getRData()
|
||||
* @see DirectionalPoolRecord#getRData()
|
||||
*/
|
||||
public Builder rdata(Object infoValue) {
|
||||
this.infoValues = ImmutableList.<String> builder().add(infoValue.toString());
|
||||
|
@ -156,18 +156,18 @@ public class DirectionalRecord {
|
|||
/**
|
||||
* replaces current values
|
||||
*
|
||||
* @see DirectionalRecord#getRData()
|
||||
* @see DirectionalPoolRecord#getRData()
|
||||
*/
|
||||
public Builder rdata(Iterable<?> infoValues) {
|
||||
this.infoValues = ImmutableList.<String> builder().addAll(transform(infoValues, toStringFunction()));
|
||||
return this;
|
||||
}
|
||||
|
||||
public DirectionalRecord build() {
|
||||
return new DirectionalRecord(type, ttl, noResponseRecord, infoValues.build());
|
||||
public DirectionalPoolRecord 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);
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ import com.google.common.base.Optional;
|
|||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class DirectionalRecordDetail {
|
||||
public class DirectionalPoolRecordDetail {
|
||||
|
||||
private final String zoneName;
|
||||
private final String name;
|
||||
|
@ -36,11 +36,11 @@ public class DirectionalRecordDetail {
|
|||
private final Optional<IdAndName> group;
|
||||
private final Optional<IdAndName> geolocationGroup;
|
||||
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> sourceIpGroup, DirectionalRecord record) {
|
||||
Optional<IdAndName> sourceIpGroup, DirectionalPoolRecord record) {
|
||||
this.zoneName = checkNotNull(zoneName, "zoneName");
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.id = checkNotNull(id, "id");
|
||||
|
@ -83,7 +83,7 @@ public class DirectionalRecordDetail {
|
|||
return sourceIpGroup;
|
||||
}
|
||||
|
||||
public DirectionalRecord getRecord() {
|
||||
public DirectionalPoolRecord getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class DirectionalRecordDetail {
|
|||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -124,10 +124,10 @@ public class DirectionalRecordDetail {
|
|||
private Optional<IdAndName> group = Optional.absent();
|
||||
private Optional<IdAndName> geolocationGroup = 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) {
|
||||
this.zoneName = zoneName;
|
||||
|
@ -135,7 +135,7 @@ public class DirectionalRecordDetail {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecordDetail#getName()
|
||||
* @see DirectionalPoolRecordDetail#getName()
|
||||
*/
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
|
@ -143,7 +143,7 @@ public class DirectionalRecordDetail {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecordDetail#getId()
|
||||
* @see DirectionalPoolRecordDetail#getId()
|
||||
*/
|
||||
public Builder id(String id) {
|
||||
this.id = id;
|
||||
|
@ -151,7 +151,7 @@ public class DirectionalRecordDetail {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecordDetail#getGroup()
|
||||
* @see DirectionalPoolRecordDetail#getGroup()
|
||||
*/
|
||||
public Builder group(IdAndName group) {
|
||||
this.group = Optional.fromNullable(group);
|
||||
|
@ -159,7 +159,7 @@ public class DirectionalRecordDetail {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecordDetail#getGeolocationGroup()
|
||||
* @see DirectionalPoolRecordDetail#getGeolocationGroup()
|
||||
*/
|
||||
public Builder geolocationGroup(IdAndName geolocationGroup) {
|
||||
this.geolocationGroup = Optional.fromNullable(geolocationGroup);
|
||||
|
@ -167,7 +167,7 @@ public class DirectionalRecordDetail {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecordDetail#getSourceIpGroup()
|
||||
* @see DirectionalPoolRecordDetail#getSourceIpGroup()
|
||||
*/
|
||||
public Builder sourceIpGroup(IdAndName 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;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DirectionalRecordDetail#getRecord()
|
||||
* @see DirectionalPoolRecordDetail#getRecord()
|
||||
*/
|
||||
public Builder record(DirectionalRecord.Builder record) {
|
||||
public Builder record(DirectionalPoolRecord.Builder record) {
|
||||
this.record = record.build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public DirectionalRecordDetail build() {
|
||||
return new DirectionalRecordDetail(zoneName, name, id, group, geolocationGroup, sourceIpGroup, record);
|
||||
public DirectionalPoolRecordDetail build() {
|
||||
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())
|
||||
.geolocationGroup(in.geolocationGroup.orNull()).sourceIpGroup(in.sourceIpGroup.orNull())
|
||||
.record(in.record);
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,14 +19,19 @@
|
|||
package org.jclouds.ultradns.ws.domain;
|
||||
|
||||
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.Predicate;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -71,6 +76,25 @@ public final class IdAndName {
|
|||
|
||||
@Override
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class PoolRecordSpec {
|
|||
}
|
||||
|
||||
/**
|
||||
* correlates to {@link TrafficControllerPoolRecord#getDescription()}
|
||||
* correlates to {@link TrafficControllerPoolRecordDetail#getDescription()}
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
|
@ -71,7 +71,7 @@ public final class PoolRecordSpec {
|
|||
}
|
||||
|
||||
/**
|
||||
* correlates to {@link TrafficControllerPoolRecord#isProbingEnabled()}
|
||||
* correlates to {@link TrafficControllerPoolRecordDetail#isProbingEnabled()}
|
||||
*/
|
||||
public boolean isProbingEnabled() {
|
||||
return probingEnabled;
|
||||
|
@ -85,7 +85,7 @@ public final class PoolRecordSpec {
|
|||
}
|
||||
|
||||
/**
|
||||
* correlates to {@link TrafficControllerPoolRecord#getWeight()}
|
||||
* correlates to {@link TrafficControllerPoolRecordDetail#getWeight()}
|
||||
*/
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.google.common.base.Objects;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class ResourceRecordMetadata {
|
||||
public class ResourceRecordDetail {
|
||||
|
||||
private final String zoneId;
|
||||
private final String guid;
|
||||
|
@ -39,7 +39,7 @@ public class ResourceRecordMetadata {
|
|||
private final Date modified;
|
||||
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) {
|
||||
this.zoneId = checkNotNull(zoneId, "zoneId");
|
||||
this.guid = checkNotNull(guid, "guid");
|
||||
|
@ -87,7 +87,7 @@ public class ResourceRecordMetadata {
|
|||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class ResourceRecordMetadata {
|
|||
private ResourceRecord record;
|
||||
|
||||
/**
|
||||
* @see ResourceRecordMetadata#getZoneName()
|
||||
* @see ResourceRecordDetail#getZoneName()
|
||||
*/
|
||||
public Builder zoneName(String zoneName) {
|
||||
this.zoneName = zoneName;
|
||||
|
@ -122,7 +122,7 @@ public class ResourceRecordMetadata {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ResourceRecordMetadata#getGuid()
|
||||
* @see ResourceRecordDetail#getGuid()
|
||||
*/
|
||||
public Builder guid(String guid) {
|
||||
this.guid = guid;
|
||||
|
@ -130,7 +130,7 @@ public class ResourceRecordMetadata {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ResourceRecordMetadata#getZoneId()
|
||||
* @see ResourceRecordDetail#getZoneId()
|
||||
*/
|
||||
public Builder zoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
|
@ -138,7 +138,7 @@ public class ResourceRecordMetadata {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ResourceRecordMetadata#getCreated()
|
||||
* @see ResourceRecordDetail#getCreated()
|
||||
*/
|
||||
public Builder created(Date created) {
|
||||
this.created = created;
|
||||
|
@ -146,7 +146,7 @@ public class ResourceRecordMetadata {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ResourceRecordMetadata#getModified()
|
||||
* @see ResourceRecordDetail#getModified()
|
||||
*/
|
||||
public Builder modified(Date modified) {
|
||||
this.modified = modified;
|
||||
|
@ -154,7 +154,7 @@ public class ResourceRecordMetadata {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ResourceRecordMetadata#getRecord()
|
||||
* @see ResourceRecordDetail#getRecord()
|
||||
*/
|
||||
public Builder record(ResourceRecord record) {
|
||||
this.record = record;
|
||||
|
@ -162,18 +162,18 @@ public class ResourceRecordMetadata {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see ResourceRecordMetadata#getRecord()
|
||||
* @see ResourceRecordDetail#getRecord()
|
||||
*/
|
||||
public Builder record(ResourceRecord.Builder record) {
|
||||
this.record = record.build();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResourceRecordMetadata build() {
|
||||
return new ResourceRecordMetadata(zoneId, guid, zoneName, created, modified, record);
|
||||
public ResourceRecordDetail build() {
|
||||
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)
|
||||
.record(in.record);
|
||||
}
|
|
@ -99,6 +99,30 @@ public final class TrafficControllerPool {
|
|||
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
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(zoneId, id, name, dname);
|
||||
|
|
|
@ -18,82 +18,34 @@
|
|||
*/
|
||||
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 com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 forceAnswer;
|
||||
private final boolean probingEnabled;
|
||||
private final Status status;
|
||||
private final boolean serving;
|
||||
private final String description;
|
||||
private final String rdata;
|
||||
|
||||
private TrafficControllerPoolRecord(String id, String poolId, String pointsTo, int weight, int priority,
|
||||
String type, String forceAnswer, boolean probingEnabled, Status status, boolean serving, String description) {
|
||||
this.id = checkNotNull(id, "id");
|
||||
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 2–100. 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;
|
||||
private TrafficControllerPoolRecord(String type, String rdata) {
|
||||
this.type = checkNotNull(type, "type");
|
||||
this.rdata = checkNotNull(rdata, "rdata");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,188 +55,31 @@ public final class TrafficControllerPoolRecord {
|
|||
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() {
|
||||
return status;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
public String getRData() {
|
||||
return rdata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(id, poolId);
|
||||
return Objects.hashCode(type, rdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
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
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("id", id).add("poolId", poolId).add("pointsTo", pointsTo)
|
||||
.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);
|
||||
}
|
||||
return toStringHelper(this).add("type", type).add("rdata", rdata).toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 2–100. 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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,13 +34,13 @@ public final class UpdatePoolRecord {
|
|||
|
||||
/**
|
||||
* @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) {
|
||||
return new Builder().from(spec).pointsTo(pointsTo).build();
|
||||
public static UpdatePoolRecord pointingTo(PoolRecordSpec spec, String rdata) {
|
||||
return new Builder().from(spec).rdata(rdata).build();
|
||||
}
|
||||
|
||||
private final String pointsTo;
|
||||
private final String rdata;
|
||||
private final String mode;
|
||||
private final int priority;
|
||||
private final int weight;
|
||||
|
@ -48,26 +48,26 @@ public final class UpdatePoolRecord {
|
|||
private final int threshold;
|
||||
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) {
|
||||
this.pointsTo = checkNotNull(pointsTo, "pointsTo");
|
||||
this.mode = checkNotNull(mode, "mode for %s", pointsTo);
|
||||
this.rdata = checkNotNull(rdata, "rdata");
|
||||
this.mode = checkNotNull(mode, "mode for %s", rdata);
|
||||
this.priority = priority;
|
||||
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;
|
||||
checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", pointsTo);
|
||||
checkArgument(failOverDelay >= 0, "failOverDelay of %s must be >= 0", rdata);
|
||||
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;
|
||||
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() {
|
||||
return pointsTo;
|
||||
public String getRData() {
|
||||
return rdata;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,7 +114,7 @@ public final class UpdatePoolRecord {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(pointsTo, mode, priority, weight, failOverDelay, threshold, ttl);
|
||||
return Objects.hashCode(rdata, mode, priority, weight, failOverDelay, threshold, ttl);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,14 +126,14 @@ public final class UpdatePoolRecord {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
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.threshold, that.threshold) && equal(this.ttl, that.ttl);
|
||||
}
|
||||
|
||||
@Override
|
||||
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)
|
||||
.toString();
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public final class UpdatePoolRecord {
|
|||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String pointsTo;
|
||||
private String rdata;
|
||||
private String mode;
|
||||
private int priority;
|
||||
private int weight;
|
||||
|
@ -156,10 +156,10 @@ public final class UpdatePoolRecord {
|
|||
private int ttl;
|
||||
|
||||
/**
|
||||
* @see UpdatePoolRecord#getPointsTo()
|
||||
* @see UpdatePoolRecord#getRData()
|
||||
*/
|
||||
public Builder pointsTo(String pointsTo) {
|
||||
this.pointsTo = pointsTo;
|
||||
public Builder rdata(String rdata) {
|
||||
this.rdata = rdata;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public final class UpdatePoolRecord {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -220,12 +220,12 @@ public final class UpdatePoolRecord {
|
|||
.threshold(in.getThreshold()).ttl(in.getTTL());
|
||||
}
|
||||
|
||||
public Builder from(TrafficControllerPoolRecord in) {
|
||||
return this.weight(in.getWeight()).pointsTo(in.getPointsTo()).priority(in.getPriority());
|
||||
public Builder from(TrafficControllerPoolRecordDetail in) {
|
||||
return this.weight(in.getWeight()).rdata(in.getRecord().getRData()).priority(in.getPriority());
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ import org.jclouds.ultradns.ws.binders.DirectionalGroupCoordinatesToXML;
|
|||
import org.jclouds.ultradns.ws.domain.AccountLevelGroup;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalGroup;
|
||||
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.xml.AccountLevelGroupsHandler;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalGroupNameAndRegionsHandler;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalGroupHandler;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler;
|
||||
import org.jclouds.ultradns.ws.xml.ItemListHandler;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
@ -63,7 +63,7 @@ public interface DirectionalGroupApi {
|
|||
*/
|
||||
@Named("getDirectionalDNSGroupDetails")
|
||||
@POST
|
||||
@XMLResponseParser(DirectionalGroupNameAndRegionsHandler.class)
|
||||
@XMLResponseParser(DirectionalGroupHandler.class)
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
@Payload("<v01:getDirectionalDNSGroupDetails><GroupId>{GroupId}</GroupId></v01:getDirectionalDNSGroupDetails>")
|
||||
@Nullable
|
||||
|
@ -89,9 +89,9 @@ public interface DirectionalGroupApi {
|
|||
*/
|
||||
@Named("getDirectionalDNSRecordsForAcctLvlGroup")
|
||||
@POST
|
||||
@XMLResponseParser(DirectionalRecordDetailListHandler.class)
|
||||
@XMLResponseParser(DirectionalPoolRecordDetailListHandler.class)
|
||||
@Payload("<v01:getDirectionalDNSRecordsForAcctLvlGroup><groupId>{groupId}</groupId></v01:getDirectionalDNSRecordsForAcctLvlGroup>")
|
||||
FluentIterable<DirectionalRecordDetail> listRecordsByAccountLevelGroup(
|
||||
FluentIterable<DirectionalPoolRecordDetail> listRecordsByAccountLevelGroup(
|
||||
@PayloadParam("groupId") String groupId) throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
|
@ -126,9 +126,9 @@ public interface DirectionalGroupApi {
|
|||
*/
|
||||
@Named("getDirectionalDNSRecordsForGroup")
|
||||
@POST
|
||||
@XMLResponseParser(DirectionalRecordDetailListHandler.class)
|
||||
@XMLResponseParser(DirectionalPoolRecordDetailListHandler.class)
|
||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||
FluentIterable<DirectionalRecordDetail> listRecordsByGroupCoordinates(
|
||||
FluentIterable<DirectionalPoolRecordDetail> listRecordsByGroupCoordinates(
|
||||
@BinderParam(DirectionalGroupCoordinatesToXML.class) DirectionalGroupCoordinates group)
|
||||
throws ResourceNotFoundException;
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
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.xml.DirectionalPoolListHandler;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
||||
|
@ -75,10 +75,10 @@ public interface DirectionalPoolApi {
|
|||
*/
|
||||
@Named("getDirectionalDNSRecordsForHost")
|
||||
@POST
|
||||
@XMLResponseParser(DirectionalRecordDetailListHandler.class)
|
||||
@XMLResponseParser(DirectionalPoolRecordDetailListHandler.class)
|
||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||
@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)
|
||||
throws ResourceNotFoundException;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jclouds.rest.annotations.XMLResponseParser;
|
|||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML;
|
||||
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.xml.ElementTextHandler;
|
||||
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
|
||||
|
@ -92,7 +92,7 @@ public interface ResourceRecordApi {
|
|||
@POST
|
||||
@XMLResponseParser(ResourceRecordListHandler.class)
|
||||
@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
|
||||
|
@ -107,7 +107,7 @@ public interface ResourceRecordApi {
|
|||
@POST
|
||||
@XMLResponseParser(ResourceRecordListHandler.class)
|
||||
@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;
|
||||
|
||||
/**
|
||||
|
@ -126,7 +126,7 @@ public interface ResourceRecordApi {
|
|||
@POST
|
||||
@XMLResponseParser(ResourceRecordListHandler.class)
|
||||
@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)
|
||||
throws ResourceNotFoundException;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.rest.annotations.VirtualHost;
|
|||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
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.filters.SOAPWrapWithPasswordAuth;
|
||||
import org.jclouds.ultradns.ws.xml.ElementTextHandler;
|
||||
|
@ -71,7 +71,7 @@ public interface RoundRobinPoolApi {
|
|||
@POST
|
||||
@XMLResponseParser(ResourceRecordListHandler.class)
|
||||
@Payload("<v01:getRRPoolRecords><lbPoolId>{poolId}</lbPoolId></v01:getRRPoolRecords>")
|
||||
FluentIterable<ResourceRecordMetadata> listRecords(@PayloadParam("poolId") String poolId)
|
||||
FluentIterable<ResourceRecordDetail> listRecords(@PayloadParam("poolId") String poolId)
|
||||
throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ public interface RoundRobinPoolApi {
|
|||
*
|
||||
* @param name
|
||||
* {@link RoundRobinPool#getName() name} of the RR pool
|
||||
* @param hostname
|
||||
* @param dname
|
||||
* {@link RoundRobinPool#getDName() dname} of the RR pool {ex.
|
||||
* www.jclouds.org.}
|
||||
* @return the {@code guid} of the new pool
|
||||
|
@ -90,8 +90,8 @@ public interface RoundRobinPoolApi {
|
|||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.RRPoolID.class)
|
||||
@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,
|
||||
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
||||
String createAPoolForDName(@PayloadParam("description") String name,
|
||||
@PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* adds a new {@code A} record to the pool
|
||||
|
@ -155,8 +155,8 @@ public interface RoundRobinPoolApi {
|
|||
*
|
||||
* @param name
|
||||
* {@link RoundRobinPool#getName() name} of the RR pool
|
||||
* @param hostname
|
||||
* {@link RoundRobinPool#getDName() hostname} {ex.
|
||||
* @param dname
|
||||
* {@link RoundRobinPool#getDName() dname} {ex.
|
||||
* www.jclouds.org.}
|
||||
* @return the {@code guid} of the new record
|
||||
* @throws ResourceAlreadyExistsException
|
||||
|
@ -166,8 +166,8 @@ public interface RoundRobinPoolApi {
|
|||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.RRPoolID.class)
|
||||
@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,
|
||||
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
||||
String createAAAAPoolForDName(@PayloadParam("description") String name,
|
||||
@PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* adds a new {@code AAAA} record to the pool
|
||||
|
|
|
@ -36,14 +36,15 @@ import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsExcepti
|
|||
import org.jclouds.ultradns.ws.binders.UpdatePoolRecordToXML;
|
||||
import org.jclouds.ultradns.ws.domain.PoolRecordSpec;
|
||||
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.filters.SOAPWrapWithPasswordAuth;
|
||||
import org.jclouds.ultradns.ws.xml.AttributeHandler;
|
||||
import org.jclouds.ultradns.ws.xml.ElementTextHandler;
|
||||
import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler;
|
||||
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;
|
||||
|
||||
|
@ -61,9 +62,11 @@ public interface TrafficControllerPoolApi {
|
|||
*
|
||||
* @param name
|
||||
* {@link TrafficControllerPool#getName() name} of the TC pool
|
||||
* @param hostname
|
||||
* @param dname
|
||||
* {@link TrafficControllerPool#getDName() dname} of the TC pool
|
||||
* {ex. www.jclouds.org.}
|
||||
* @param type
|
||||
* the record types supported.
|
||||
* @return the {@code guid} of the new record
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a pool already exists with the same attrs
|
||||
|
@ -71,9 +74,9 @@ public interface TrafficControllerPoolApi {
|
|||
@Named("addTCLBPool")
|
||||
@POST
|
||||
@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>")
|
||||
String createPoolForHostname(@PayloadParam("description") String name, @PayloadParam("hostName") String hostname)
|
||||
throws ResourceAlreadyExistsException;
|
||||
@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 createPoolForDNameAndType(@PayloadParam("description") String name, @PayloadParam("hostName") String dname,
|
||||
@PayloadParam("poolRecordType") RecordType type) throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* Returns all traffic controller pools in the zone.
|
||||
|
@ -95,9 +98,9 @@ public interface TrafficControllerPoolApi {
|
|||
*/
|
||||
@Named("getPoolRecords")
|
||||
@POST
|
||||
@XMLResponseParser(TrafficControllerPoolRecordListHandler.class)
|
||||
@XMLResponseParser(TrafficControllerPoolRecordDetailListHandler.class)
|
||||
@Payload("<v01:getPoolRecords><poolId>{poolId}</poolId></v01:getPoolRecords>")
|
||||
FluentIterable<TrafficControllerPoolRecord> listRecords(@PayloadParam("poolId") String poolId)
|
||||
FluentIterable<TrafficControllerPoolRecordDetail> listRecords(@PayloadParam("poolId") String poolId)
|
||||
throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
|
@ -130,13 +133,13 @@ public interface TrafficControllerPoolApi {
|
|||
/**
|
||||
* adds a new record to the pool with default weight.
|
||||
*
|
||||
* @param pointsTo
|
||||
* @param rdata
|
||||
* the ipv4 address or hostname
|
||||
* @param lbPoolID
|
||||
* the pool to add the record to.
|
||||
* @param ttl
|
||||
* 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
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a record already exists with the same attrs
|
||||
|
@ -145,13 +148,13 @@ public interface TrafficControllerPoolApi {
|
|||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.PoolRecordID.class)
|
||||
@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;
|
||||
|
||||
/**
|
||||
* adds a new record to the pool with a specified weight.
|
||||
*
|
||||
* @param pointsTo
|
||||
* @param rdata
|
||||
* the ipv4 address or hostname
|
||||
* @param lbPoolID
|
||||
* the pool to add the record to.
|
||||
|
@ -159,7 +162,7 @@ public interface TrafficControllerPoolApi {
|
|||
* the {@link PoolRecordSpec#getTTL ttl} of the record
|
||||
* @param weight
|
||||
* 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
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a record already exists with the same attrs
|
||||
|
@ -168,13 +171,13 @@ public interface TrafficControllerPoolApi {
|
|||
@POST
|
||||
@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>")
|
||||
String addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String pointsTo,
|
||||
String addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String rdata,
|
||||
@PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl, @PayloadParam("weight") int weight)
|
||||
throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* @param poolRecordID
|
||||
* {@link TrafficControllerPoolRecord#getId()}
|
||||
* {@link TrafficControllerPoolRecordDetail#getId()}
|
||||
* @return null if not found
|
||||
*/
|
||||
@Named("getPoolRecordSpec>")
|
||||
|
@ -189,7 +192,7 @@ public interface TrafficControllerPoolApi {
|
|||
* This request updates an existing pool record.
|
||||
*
|
||||
* @param poolRecordID
|
||||
* {@link TrafficControllerPoolRecord#getId()}
|
||||
* {@link TrafficControllerPoolRecordDetail#getId()}
|
||||
* @param update
|
||||
* what to update, usually primed via
|
||||
* {@link UpdatePoolRecord#pointingTo(PoolRecordSpec, String)} or
|
||||
|
|
|
@ -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 + ")";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.predicates;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
private static final class RecordIdEqualToPredicate implements Predicate<TrafficControllerPoolRecord> {
|
||||
private static final class RecordIdEqualToPredicate implements Predicate<TrafficControllerPoolRecordDetail> {
|
||||
private final String recordId;
|
||||
|
||||
public RecordIdEqualToPredicate(String recordId) {
|
||||
|
@ -66,7 +66,7 @@ public class TrafficControllerPoolPredicates {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(TrafficControllerPoolRecord input) {
|
||||
public boolean apply(TrafficControllerPoolRecordDetail input) {
|
||||
return input != null && recordId.equals(input.getId());
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class AccountHandler extends ParseSax.HandlerForGeneratedRequestWithResul
|
|||
public void startElement(String uri, String localName, String qName, Attributes attrs) {
|
||||
Map<String, String> attributes = cleanseAttributes(attrs);
|
||||
if (equalsOrSuffix(qName, "AccountDetailsData")) {
|
||||
account = IdAndName.fromIdAndName(attributes.get("accountID"), attributes.get("accountName"));
|
||||
account = IdAndName.create(attributes.get("accountID"), attributes.get("accountName"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,13 @@ import org.jclouds.ultradns.ws.domain.DirectionalGroup.Builder;
|
|||
import org.xml.sax.Attributes;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGeneratedRequestWithResult<DirectionalGroup> {
|
||||
public class DirectionalGroupHandler extends ParseSax.HandlerForGeneratedRequestWithResult<DirectionalGroup> {
|
||||
|
||||
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) {
|
||||
if (equalsOrSuffix(qName, "DirectionalDNSGroupDetail")) {
|
||||
group.name(attrs.getValue("GroupName"));
|
||||
group.description(attrs.getValue("Description"));
|
||||
} else if (equalsOrSuffix(qName, "RegionForNewGroups")) {
|
||||
String regionName = attrs.getValue("RegionName");
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,8 +54,8 @@ public class DirectionalPoolListHandler extends ParseSax.HandlerForGeneratedRequ
|
|||
DirectionalPool.Builder pool = DirectionalPool.builder()
|
||||
.zoneId(attributes.get("Zoneid"))
|
||||
.id(attributes.get("dirpoolid"))
|
||||
.name(attributes.get("Pooldname"))
|
||||
.description(attributes.get("Description"));
|
||||
.dname(attributes.get("Pooldname"))
|
||||
.name(attributes.get("Description"));
|
||||
|
||||
String type = attributes.get("DirPoolType");
|
||||
if (type != null)
|
||||
|
|
|
@ -25,30 +25,30 @@ import java.util.Map;
|
|||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import static org.jclouds.ultradns.ws.domain.IdAndName.*;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecord;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class DirectionalRecordDetailHandler extends
|
||||
ParseSax.HandlerForGeneratedRequestWithResult<DirectionalRecordDetail> {
|
||||
public class DirectionalPoolRecordDetailHandler extends
|
||||
ParseSax.HandlerForGeneratedRequestWithResult<DirectionalPoolRecordDetail> {
|
||||
|
||||
private DirectionalRecordDetail.Builder drd = DirectionalRecordDetail.builder();
|
||||
private DirectionalRecord.Builder dr = DirectionalRecord.drBuilder();
|
||||
private DirectionalPoolRecordDetail.Builder drd = DirectionalPoolRecordDetail.builder();
|
||||
private DirectionalPoolRecord.Builder dr = DirectionalPoolRecord.drBuilder();
|
||||
|
||||
private String zoneName;
|
||||
private String dname;
|
||||
|
||||
@Override
|
||||
public DirectionalRecordDetail getResult() {
|
||||
public DirectionalPoolRecordDetail getResult() {
|
||||
try {
|
||||
return drd.record(dr.build()).build();
|
||||
} finally {
|
||||
drd = DirectionalRecordDetail.builder().zoneName(zoneName).name(dname);
|
||||
dr = DirectionalRecord.drBuilder();
|
||||
drd = DirectionalPoolRecordDetail.builder().zoneName(zoneName).name(dname);
|
||||
dr = DirectionalPoolRecord.drBuilder();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,14 +64,14 @@ public class DirectionalRecordDetailHandler extends
|
|||
drd.id(attributes.get("DirPoolRecordId"));
|
||||
}
|
||||
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")) {
|
||||
drd.geolocationGroup(fromIdAndName(attributes.get("GeolocationGroupId"),
|
||||
drd.geolocationGroup(create(attributes.get("GeolocationGroupId"),
|
||||
attributes.get("GeolocationGroupName")));
|
||||
}
|
||||
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")) {
|
||||
dr.type(attributes.get("recordType"));
|
|
@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.xml;
|
|||
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
|
||||
|
||||
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 com.google.common.collect.FluentIterable;
|
||||
|
@ -33,20 +33,20 @@ import com.google.inject.Inject;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class DirectionalRecordDetailListHandler extends
|
||||
ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<DirectionalRecordDetail>> {
|
||||
public class DirectionalPoolRecordDetailListHandler extends
|
||||
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
|
||||
public DirectionalRecordDetailListHandler(DirectionalRecordDetailHandler directionalRecordHandler) {
|
||||
public DirectionalPoolRecordDetailListHandler(DirectionalPoolRecordDetailHandler directionalRecordHandler) {
|
||||
this.directionalRecordHandler = directionalRecordHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluentIterable<DirectionalRecordDetail> getResult() {
|
||||
public FluentIterable<DirectionalPoolRecordDetail> getResult() {
|
||||
return FluentIterable.from(drs.build());
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ public class RegionListHandler extends ParseSax.HandlerForGeneratedRequestWithRe
|
|||
public void startElement(String url, String name, String qName, Attributes attrs) {
|
||||
if (equalsOrSuffix(qName, "Region")) {
|
||||
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")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
|||
import org.jclouds.date.DateService;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
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 com.google.inject.Inject;
|
||||
|
@ -35,24 +35,24 @@ import com.google.inject.Inject;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class ResourceRecordMetadataHandler extends
|
||||
ParseSax.HandlerForGeneratedRequestWithResult<ResourceRecordMetadata> {
|
||||
public class ResourceRecordDetailHandler extends
|
||||
ParseSax.HandlerForGeneratedRequestWithResult<ResourceRecordDetail> {
|
||||
private final DateService dateService;
|
||||
|
||||
@Inject
|
||||
private ResourceRecordMetadataHandler(DateService dateService) {
|
||||
private ResourceRecordDetailHandler(DateService dateService) {
|
||||
this.dateService = dateService;
|
||||
}
|
||||
|
||||
private ResourceRecordMetadata.Builder rrm = ResourceRecordMetadata.builder();
|
||||
private ResourceRecordDetail.Builder rrm = ResourceRecordDetail.builder();
|
||||
private ResourceRecord.Builder rr = ResourceRecord.rrBuilder();
|
||||
|
||||
@Override
|
||||
public ResourceRecordMetadata getResult() {
|
||||
public ResourceRecordDetail getResult() {
|
||||
try {
|
||||
return rrm.record(rr.build()).build();
|
||||
} finally {
|
||||
rrm = ResourceRecordMetadata.builder();
|
||||
rrm = ResourceRecordDetail.builder();
|
||||
rr = ResourceRecord.rrBuilder();
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws.xml;
|
|||
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
|
||||
|
||||
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 com.google.common.collect.FluentIterable;
|
||||
|
@ -34,19 +34,19 @@ import com.google.inject.Inject;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
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
|
||||
public ResourceRecordListHandler(ResourceRecordMetadataHandler resourceRecordHandler) {
|
||||
public ResourceRecordListHandler(ResourceRecordDetailHandler resourceRecordHandler) {
|
||||
this.resourceRecordHandler = resourceRecordHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluentIterable<ResourceRecordMetadata> getResult() {
|
||||
public FluentIterable<ResourceRecordDetail> getResult() {
|
||||
return FluentIterable.from(rrs.build());
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class RoundRobinPoolHandler extends ParseSax.HandlerForGeneratedRequestWi
|
|||
if (equalsOrSuffix(qName, "LBPoolData")) {
|
||||
pool.zoneId(attributes.get("zoneid"));
|
||||
} 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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class TrafficControllerPoolHandler extends ParseSax.HandlerForGeneratedRe
|
|||
if (equalsOrSuffix(qName, "LBPoolData")) {
|
||||
pool.zoneId(attributes.get("zoneid"));
|
||||
} 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.failOverEnabled("Enabled".equalsIgnoreCase(attributes.get("FailOver")));
|
||||
pool.probingEnabled("Enabled".equalsIgnoreCase(attributes.get("Probing")));
|
||||
|
|
|
@ -26,7 +26,8 @@ import java.util.Map;
|
|||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
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 com.google.common.collect.FluentIterable;
|
||||
|
@ -37,13 +38,13 @@ import com.google.common.collect.ImmutableSet.Builder;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class TrafficControllerPoolRecordListHandler extends
|
||||
ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<TrafficControllerPoolRecord>> {
|
||||
public class TrafficControllerPoolRecordDetailListHandler extends
|
||||
ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<TrafficControllerPoolRecordDetail>> {
|
||||
|
||||
private final Builder<TrafficControllerPoolRecord> records = ImmutableSet.<TrafficControllerPoolRecord> builder();
|
||||
private final Builder<TrafficControllerPoolRecordDetail> records = ImmutableSet.<TrafficControllerPoolRecordDetail> builder();
|
||||
|
||||
@Override
|
||||
public FluentIterable<TrafficControllerPoolRecord> getResult() {
|
||||
public FluentIterable<TrafficControllerPoolRecordDetail> getResult() {
|
||||
return FluentIterable.from(records.build());
|
||||
}
|
||||
|
||||
|
@ -52,13 +53,15 @@ public class TrafficControllerPoolRecordListHandler extends
|
|||
if (!equalsOrSuffix(qName, "PoolRecordData"))
|
||||
return;
|
||||
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"))
|
||||
.poolId(attributes.get("poolId"))
|
||||
.pointsTo(attributes.get("pointsTo"))
|
||||
.record(record)
|
||||
.weight(parseInt(checkNotNull(attributes.get("weight"), "weight")))
|
||||
.priority(parseInt(checkNotNull(attributes.get("priority"), "priority")))
|
||||
.type(attributes.get("recordType"))
|
||||
.forceAnswer(attributes.get("forceAnswer"))
|
||||
.probingEnabled("ENABLED".equalsIgnoreCase(attributes.get("probing")))
|
||||
.status(Status.valueOf(attributes.get("status")))
|
|
@ -65,7 +65,7 @@ public class UltraDNSWSApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
|||
UltraDNSWSApi success = requestSendsResponse(getRegionsById, getRegionsByIdResponse);
|
||||
|
||||
assertEquals(
|
||||
success.getRegionsById().toString(),
|
||||
success.getRegionsByIdAndName().toString(),
|
||||
new GetAvailableRegionsResponseTest().expected().toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class UltraDNSWSApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
|
||||
@Test
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ import java.util.EnumSet;
|
|||
import java.util.Set;
|
||||
|
||||
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.DirectionalGroupCoordinates;
|
||||
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.DirectionalRecordDetail;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecordType;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType;
|
||||
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.internal.BaseUltraDNSWSApiLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
@ -72,7 +72,7 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
@Test
|
||||
public void testListRecordsByAccountLevelGroup() {
|
||||
for (AccountLevelGroup group : api().listAccountLevelGroups()) {
|
||||
for (DirectionalRecordDetail rr : api().listRecordsByAccountLevelGroup(group.getId())) {
|
||||
for (DirectionalPoolRecordDetail rr : api().listRecordsByAccountLevelGroup(group.getId())) {
|
||||
DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr);
|
||||
}
|
||||
}
|
||||
|
@ -93,11 +93,11 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
public void testListGroupNamesByRecordNameAndType() {
|
||||
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
|
||||
for (DirectionalPool pool : api.getDirectionalPoolApiForZone(zone.getName()).list()) {
|
||||
for (DirectionalRecordType type : EnumSet.allOf(DirectionalRecordType.class)) {
|
||||
for (String groupName : api().listGroupNamesByRecordNameAndType(pool.getName(), type.getCode())) {
|
||||
for (RecordType type : EnumSet.allOf(RecordType.class)) {
|
||||
for (String groupName : api().listGroupNamesByRecordNameAndType(pool.getDName(), type.getCode())) {
|
||||
allGroups.add(DirectionalGroupCoordinates.builder()
|
||||
.zoneName(zone.getName())
|
||||
.recordName(pool.getName())
|
||||
.recordName(pool.getDName())
|
||||
.recordType(type.getCode())
|
||||
.groupName(groupName).build());
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
@Test(dependsOnMethods = "testListGroupNamesByRecordNameAndType")
|
||||
public void testListRecordsByGroupCoordinates() {
|
||||
for (DirectionalGroupCoordinates group : allGroups) {
|
||||
for (DirectionalRecordDetail rr : api().listRecordsByGroupCoordinates(group)) {
|
||||
for (DirectionalPoolRecordDetail rr : api().listRecordsByGroupCoordinates(group)) {
|
||||
DirectionalPoolApiLiveTest.checkDirectionalRecordDetail(rr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ import java.util.Set;
|
|||
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecord;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecordType;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
|
||||
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.internal.BaseUltraDNSWSApiLiveTest;
|
||||
|
@ -69,8 +69,8 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
private void checkDirectional(DirectionalPool pool) {
|
||||
assertNotNull(pool.getZoneId(), "ZoneId cannot be null " + pool);
|
||||
assertNotNull(pool.getId(), "Id cannot be null " + pool);
|
||||
assertNotNull(pool.getName(), "DName cannot be null " + pool);
|
||||
assertNotNull(pool.getDescription(), "Description cannot be null " + pool);
|
||||
assertNotNull(pool.getDName(), "DName cannot be null " + pool);
|
||||
assertNotNull(pool.getName(), "Name cannot be null " + pool);
|
||||
assertNotNull(pool.getType(), "Type cannot be null " + pool);
|
||||
assertNotNull(pool.getTieBreak(), "TieBreak cannot be null " + pool);
|
||||
}
|
||||
|
@ -81,9 +81,9 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
public void testListDirectionalRecords() {
|
||||
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
|
||||
for (DirectionalPool pool : api(zone.getName()).list()) {
|
||||
for (DirectionalRecordType type : EnumSet.allOf(DirectionalRecordType.class)) {
|
||||
for (DirectionalRecordDetail rr : api(zone.getName())
|
||||
.listRecordsByNameAndType(pool.getName(), type.getCode())) {
|
||||
for (RecordType type : EnumSet.allOf(RecordType.class)) {
|
||||
for (DirectionalPoolRecordDetail rr : api(zone.getName())
|
||||
.listRecordsByNameAndType(pool.getDName(), type.getCode())) {
|
||||
checkDirectionalRecordDetail(rr);
|
||||
Iterable<IdAndName> groups = Optional.presentInstances(ImmutableSet.of(rr.getGroup(),
|
||||
rr.getGeolocationGroup(), rr.getGeolocationGroup()));
|
||||
|
@ -94,7 +94,7 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
assertNotNull(group.getName(), "Name cannot be null " + group);
|
||||
}
|
||||
assertEquals(rr.getZoneName(), zone.getName());
|
||||
assertEquals(rr.getName(), pool.getName());
|
||||
assertEquals(rr.getName(), pool.getDName());
|
||||
switch (pool.getType()) {
|
||||
case GEOLOCATION:
|
||||
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.getTTL(), "TTL 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.getName(), "DName cannot be null " + rr);
|
||||
assertNotNull(rr.getId(), "Id cannot be null " + rr);
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.jclouds.rest.ResourceNotFoundException;
|
|||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.domain.IdAndName;
|
||||
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.internal.BaseUltraDNSWSApiLiveTest;
|
||||
import org.testng.annotations.AfterClass;
|
||||
|
@ -80,7 +80,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
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.getGuid(), "Guid 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() {
|
||||
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
|
||||
zones.incrementAndGet();
|
||||
for (ResourceRecordMetadata rr : api(zone.getName()).list()) {
|
||||
for (ResourceRecordDetail rr : api(zone.getName()).list()) {
|
||||
recordTypeCounts.getUnchecked(rr.getRecord().getType()).incrementAndGet();
|
||||
checkResourceRecordMetadata(rr);
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
assertFalse(listRRs().anyMatch(equalTo(mx)));
|
||||
}
|
||||
|
||||
static Function<ResourceRecordMetadata, ResourceRecord> toRecord = new Function<ResourceRecordMetadata, ResourceRecord>() {
|
||||
public ResourceRecord apply(ResourceRecordMetadata in) {
|
||||
static Function<ResourceRecordDetail, ResourceRecord> toRecord = new Function<ResourceRecordDetail, ResourceRecord>() {
|
||||
public ResourceRecord apply(ResourceRecordDetail in) {
|
||||
checkResourceRecordMetadata(in);
|
||||
return in.getRecord();
|
||||
}
|
||||
|
|
|
@ -52,12 +52,12 @@ public class RoundRobinPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
|||
|
||||
public void testCreateAWhenResponseIs2xx() {
|
||||
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() {
|
||||
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())
|
||||
|
@ -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.")
|
||||
public void testCreateWhenResponseError2912() {
|
||||
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)
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.rest.ResourceNotFoundException;
|
|||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.domain.IdAndName;
|
||||
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.Zone;
|
||||
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
|
||||
|
@ -81,7 +81,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
public void testListRRPoolRecords() {
|
||||
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -98,15 +98,15 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
api(zoneName).delete("06063D9C54C5AE09");
|
||||
}
|
||||
|
||||
String hostname = "www.rrpool." + zoneName;
|
||||
String dname = "www.rrpool." + zoneName;
|
||||
String aPoolId;
|
||||
|
||||
@Test
|
||||
public void testCreateAPool() {
|
||||
aPoolId = api(zoneName).createAPoolForHostname("A pool", hostname);
|
||||
aPoolId = api(zoneName).createAPoolForDName("A pool", dname);
|
||||
getAnonymousLogger().info("created A rr pool: " + aPoolId);
|
||||
try {
|
||||
api(zoneName).createAPoolForHostname("A pool", hostname);
|
||||
api(zoneName).createAPoolForDName("A pool", dname);
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
Optional<RoundRobinPool> aPool = getPoolById(aPoolId);
|
||||
assertTrue(aPool.isPresent());
|
||||
assertEquals(aPool.get().getName(), "A pool");
|
||||
assertEquals(aPool.get().getDName(), hostname);
|
||||
assertEquals(aPool.get().getDName(), dname);
|
||||
}
|
||||
|
||||
String aRecord1;
|
||||
|
@ -127,12 +127,12 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
getAnonymousLogger().info("created A record: " + aRecord1);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
try {
|
||||
|
@ -147,17 +147,17 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
public void testUpdateRecord() {
|
||||
api(zoneName).updateRecordWithAddressAndTTL(aPoolId, aRecord1, "1.1.1.1", 0);
|
||||
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")
|
||||
public void testDeleteRecord() {
|
||||
api(zoneName).deleteRecord(aRecord2);
|
||||
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(
|
||||
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")
|
||||
|
@ -170,10 +170,10 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testCreateAAAAPool() {
|
||||
aaaaPoolId = api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname);
|
||||
aaaaPoolId = api(zoneName).createAAAAPoolForDName("AAAA pool", dname);
|
||||
getAnonymousLogger().info("created AAAA rr pool: " + aaaaPoolId);
|
||||
try {
|
||||
api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname);
|
||||
api(zoneName).createAAAAPoolForDName("AAAA pool", dname);
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
|
@ -181,7 +181,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
Optional<RoundRobinPool> aPool = getPoolById(aaaaPoolId);
|
||||
assertTrue(aPool.isPresent());
|
||||
assertEquals(aPool.get().getName(), "AAAA pool");
|
||||
assertEquals(aPool.get().getDName(), hostname);
|
||||
assertEquals(aPool.get().getDName(), dname);
|
||||
}
|
||||
|
||||
String aaaaRecord1;
|
||||
|
@ -195,7 +195,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
getAnonymousLogger().info("created AAAA record: " + aaaaRecord1);
|
||||
|
||||
assertTrue(listRRs(aaaaPoolId).anyMatch(
|
||||
equalTo(rrBuilder().name(hostname)
|
||||
equalTo(rrBuilder().name(dname)
|
||||
.type(28)
|
||||
.ttl(1)
|
||||
.rdata("2001:0DB8:85A3:0000:0000:8A2E:0370:7334")
|
||||
|
@ -205,7 +205,7 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
1);
|
||||
|
||||
assertTrue(listRRs(aaaaPoolId).anyMatch(
|
||||
equalTo(rrBuilder().name(hostname)
|
||||
equalTo(rrBuilder().name(dname)
|
||||
.type(28)
|
||||
.ttl(1)
|
||||
.rdata("2002:0DB8:85A3:0000:0000:8A2E:0370:7334")
|
||||
|
|
|
@ -21,6 +21,7 @@ import static com.google.common.net.HttpHeaders.HOST;
|
|||
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.OK;
|
||||
import static org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType.IPV4;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNull;
|
||||
|
||||
|
@ -50,7 +51,9 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
|
|||
|
||||
public void testCreateWhenResponseIs2xx() {
|
||||
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())
|
||||
|
@ -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.")
|
||||
public void testCreateWhenResponseError2912() {
|
||||
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)
|
||||
|
@ -189,7 +193,7 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
|
|||
}
|
||||
|
||||
UpdatePoolRecord update = UpdatePoolRecord.builder()
|
||||
.pointsTo("www.baz.com.")
|
||||
.rdata("www.baz.com.")
|
||||
.mode("Normal")
|
||||
.weight(98)
|
||||
.failOverDelay(0)
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
package org.jclouds.ultradns.ws.features;
|
||||
|
||||
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.recordIdEqualTo;
|
||||
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.TrafficControllerPool;
|
||||
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.Zone;
|
||||
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
|
||||
|
@ -85,14 +87,14 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
public void testListTCPoolRecords() {
|
||||
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TrafficControllerPoolRecord checkPoolRecordConsistent(String zoneName, TrafficControllerPoolRecord record) {
|
||||
private TrafficControllerPoolRecordDetail checkPoolRecordConsistent(String zoneName, TrafficControllerPoolRecordDetail record) {
|
||||
Optional<TrafficControllerPool> pool = getPoolByZoneAndId(zoneName, record.getPoolId());
|
||||
assertTrue(pool.isPresent(), "could not get pool for " + record);
|
||||
assertEquals(record.getDescription(), pool.get().getName());
|
||||
|
@ -103,15 +105,15 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
return checkTrafficControllerPoolRecord(record);
|
||||
}
|
||||
|
||||
static TrafficControllerPoolRecord checkTrafficControllerPoolRecord(TrafficControllerPoolRecord record) {
|
||||
static TrafficControllerPoolRecordDetail checkTrafficControllerPoolRecord(TrafficControllerPoolRecordDetail record) {
|
||||
assertNotNull(record.getId(), "Id 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.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);
|
||||
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);
|
||||
return record;
|
||||
}
|
||||
|
@ -156,25 +158,25 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Pool Record does not exist.")
|
||||
public void testUpdateRecordWhenNotFound() {
|
||||
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;
|
||||
|
||||
@Test
|
||||
public void testCreatePool() {
|
||||
poolId = api(zoneName).createPoolForHostname("pool", hostname);
|
||||
poolId = api(zoneName).createPoolForDNameAndType("pool", dname, IPV4);
|
||||
getAnonymousLogger().info("created tc pool: " + poolId);
|
||||
try {
|
||||
api(zoneName).createPoolForHostname("pool", hostname);
|
||||
api(zoneName).createPoolForDNameAndType("pool", dname, IPV4);
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
}
|
||||
// ensure there's only one pool for a hostname
|
||||
// ensure there's only one pool for a dname
|
||||
try {
|
||||
api(zoneName).createPoolForHostname("pool1", hostname);
|
||||
api(zoneName).createPoolForDNameAndType("pool1", dname, IPV4);
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
|
@ -183,7 +185,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
assertTrue(pool.isPresent());
|
||||
assertEquals(pool.get().getId(), poolId);
|
||||
assertEquals(pool.get().getName(), "pool");
|
||||
assertEquals(pool.get().getDName(), hostname);
|
||||
assertEquals(pool.get().getDName(), dname);
|
||||
checkTCPool(pool.get());
|
||||
}
|
||||
|
||||
|
@ -202,18 +204,17 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
}
|
||||
|
||||
@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;
|
||||
if (weight.isPresent()) {
|
||||
recordId = api(zoneName).addRecordToPoolWithTTLAndWeight(pointsTo, poolId, ttl, weight.get());
|
||||
recordId = api(zoneName).addRecordToPoolWithTTLAndWeight(rdata, poolId, ttl, weight.get());
|
||||
} else {
|
||||
recordId = api(zoneName).addRecordToPoolWithTTL(pointsTo, poolId, ttl);
|
||||
recordId = api(zoneName).addRecordToPoolWithTTL(rdata, poolId, ttl);
|
||||
}
|
||||
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));
|
||||
assertEquals(record.getPointsTo(), pointsTo);
|
||||
assertEquals(record.getType(), type);
|
||||
assertEquals(record.getRecord(), TrafficControllerPoolRecord.create(type, rdata));
|
||||
assertEquals(record.getWeight(), weight.or(2).intValue());
|
||||
assertEquals(recordSpec.getTTL(), ttl);
|
||||
return record;
|
||||
|
@ -240,14 +241,14 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
public void testUpdateRecord() {
|
||||
PoolRecordSpec spec = api(zoneName).getRecordSpec(cname2);
|
||||
UpdatePoolRecord update = UpdatePoolRecord.builder().from(spec)
|
||||
.pointsTo("www.baz.com.")
|
||||
.rdata("www.baz.com.")
|
||||
.weight(98)
|
||||
.ttl(200).build();
|
||||
|
||||
api(zoneName).updateRecord(cname2, update);
|
||||
|
||||
TrafficControllerPoolRecord record = getRecordById(cname2).get();
|
||||
assertEquals(record.getPointsTo(), "www.baz.com.");
|
||||
TrafficControllerPoolRecordDetail record = getRecordById(cname2).get();
|
||||
assertEquals(record.getRecord().getRData(), "www.baz.com.");
|
||||
|
||||
spec = api(zoneName).getRecordSpec(cname2);
|
||||
assertEquals(spec.getWeight(), 98);
|
||||
|
@ -267,7 +268,7 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public class GetAccountsListOfUserResponseTest extends BaseHandlerTest {
|
|||
}
|
||||
|
||||
public IdAndName expected() {
|
||||
return IdAndName.fromIdAndName("AAAAAAAAAAAAAAAA", "jclouds");
|
||||
return IdAndName.create("AAAAAAAAAAAAAAAA", "jclouds");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
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 java.io.InputStream;
|
||||
|
@ -51,8 +51,8 @@ public class GetAvailableRegionsResponseTest extends BaseHandlerTest {
|
|||
|
||||
public Multimap<IdAndName, String> expected() {
|
||||
return ImmutableMultimap.<IdAndName, String> builder()
|
||||
.put(fromIdAndName("14", "Anonymous Proxy (A1)"), "Anonymous Proxy")
|
||||
.putAll(fromIdAndName("3", "Antarctica"), ImmutableSet.<String> builder()
|
||||
.put(create("14", "Anonymous Proxy (A1)"), "Anonymous Proxy")
|
||||
.putAll(create("3", "Antarctica"), ImmutableSet.<String> builder()
|
||||
.add("Antarctica")
|
||||
.add("Bouvet Island")
|
||||
.add("French Southern Territories")
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.io.InputStream;
|
|||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
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 com.google.common.collect.ImmutableList;
|
||||
|
@ -40,7 +40,7 @@ public class GetDirectionalDNSGroupDetailsResponseTest extends BaseHandlerTest {
|
|||
|
||||
DirectionalGroup expected = expected();
|
||||
|
||||
DirectionalGroupNameAndRegionsHandler handler = injector.getInstance(DirectionalGroupNameAndRegionsHandler.class);
|
||||
DirectionalGroupHandler handler = injector.getInstance(DirectionalGroupHandler.class);
|
||||
DirectionalGroup result = factory.create(handler).parse(is);
|
||||
|
||||
assertEquals(result.toString(), expected.toString());
|
||||
|
@ -52,8 +52,9 @@ public class GetDirectionalDNSGroupDetailsResponseTest extends BaseHandlerTest {
|
|||
.mapRegionToTerritory("Anonymous Proxy (A1)", "Anonymous Proxy")
|
||||
.mapRegionToTerritory("Mexico", "Mexico")
|
||||
.mapRegionToTerritories("Antarctica", ImmutableList.<String> builder()
|
||||
.add("Antarctica")
|
||||
.add("Bouvet Island")
|
||||
.add("French Southern Territories")
|
||||
.add("Antarctica").build()).build();
|
||||
.build()).build();
|
||||
}
|
||||
}
|
|
@ -18,15 +18,15 @@
|
|||
*/
|
||||
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 java.io.InputStream;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecord;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalRecordDetailListHandler;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
@ -41,52 +41,52 @@ public class GetDirectionalDNSRecordsForHostResponseTest extends BaseHandlerTest
|
|||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/directionalrecords.xml");
|
||||
|
||||
FluentIterable<DirectionalRecordDetail> expected = expected();
|
||||
FluentIterable<DirectionalPoolRecordDetail> expected = expected();
|
||||
|
||||
DirectionalRecordDetailListHandler handler = injector.getInstance(DirectionalRecordDetailListHandler.class);
|
||||
FluentIterable<DirectionalRecordDetail> result = factory.create(handler).parse(is);
|
||||
DirectionalPoolRecordDetailListHandler handler = injector.getInstance(DirectionalPoolRecordDetailListHandler.class);
|
||||
FluentIterable<DirectionalPoolRecordDetail> result = factory.create(handler).parse(is);
|
||||
|
||||
assertEquals(result.toSet().toString(), expected.toSet().toString());
|
||||
}
|
||||
|
||||
public FluentIterable<DirectionalRecordDetail> expected() {
|
||||
return FluentIterable.from(ImmutableSet.<DirectionalRecordDetail> builder()
|
||||
.add(DirectionalRecordDetail.builder()
|
||||
public FluentIterable<DirectionalPoolRecordDetail> expected() {
|
||||
return FluentIterable.from(ImmutableSet.<DirectionalPoolRecordDetail> builder()
|
||||
.add(DirectionalPoolRecordDetail.builder()
|
||||
.zoneName("geo.jclouds.org.")
|
||||
.name("www.geo.jclouds.org.")
|
||||
.id("A000000000000001")
|
||||
.geolocationGroup(fromIdAndName("C000000000000001", "southamerica"))
|
||||
.record(DirectionalRecord.drBuilder()
|
||||
.geolocationGroup(create("C000000000000001", "southamerica"))
|
||||
.record(DirectionalPoolRecord.drBuilder()
|
||||
.type("CNAME")
|
||||
.ttl(300)
|
||||
.noResponseRecord(false)
|
||||
.rdata("southamerica.geo.jclouds.org.").build()).build())
|
||||
.add(DirectionalRecordDetail.builder()
|
||||
.add(DirectionalPoolRecordDetail.builder()
|
||||
.zoneName("geo.jclouds.org.")
|
||||
.name("www.geo.jclouds.org.")
|
||||
.id("A000000000000002")
|
||||
.group(fromIdAndName("B000000000000001", "All Non-Configured Regions"))
|
||||
.record(DirectionalRecord.drBuilder()
|
||||
.group(create("B000000000000001", "All Non-Configured Regions"))
|
||||
.record(DirectionalPoolRecord.drBuilder()
|
||||
.type("A")
|
||||
.ttl(500)
|
||||
.noResponseRecord(false)
|
||||
.rdata("1.1.1.2").build()).build())
|
||||
.add(DirectionalRecordDetail.builder()
|
||||
.add(DirectionalPoolRecordDetail.builder()
|
||||
.zoneName("geo.jclouds.org.")
|
||||
.name("www.geo.jclouds.org.")
|
||||
.id("A000000000000003")
|
||||
.geolocationGroup(fromIdAndName("C000000000000002", "antarctica-unsupported"))
|
||||
.record(DirectionalRecord.drBuilder()
|
||||
.geolocationGroup(create("C000000000000002", "antarctica-unsupported"))
|
||||
.record(DirectionalPoolRecord.drBuilder()
|
||||
.type("A")
|
||||
.ttl(0)
|
||||
.noResponseRecord(true)
|
||||
.rdata("No Data Response").build()).build())
|
||||
.add(DirectionalRecordDetail.builder()
|
||||
.add(DirectionalPoolRecordDetail.builder()
|
||||
.zoneName("geo.jclouds.org.")
|
||||
.name("www.geo.jclouds.org.")
|
||||
.id("A000000000000004")
|
||||
.geolocationGroup(fromIdAndName("C000000000000003", "alazona"))
|
||||
.record(DirectionalRecord.drBuilder()
|
||||
.geolocationGroup(create("C000000000000003", "alazona"))
|
||||
.record(DirectionalPoolRecord.drBuilder()
|
||||
.type("A")
|
||||
.ttl(86400) // default
|
||||
.noResponseRecord(false)
|
||||
|
|
|
@ -54,13 +54,13 @@ public class GetDirectionalPoolsByZoneResponseTest extends BaseHandlerTest {
|
|||
.add(DirectionalPool.builder()
|
||||
.zoneId("0000000000000001")
|
||||
.id("000000000000000A")
|
||||
.name("mixy.jclouds.org.")
|
||||
.dname("mixy.jclouds.org.")
|
||||
.type(Type.MIXED)
|
||||
.tieBreak(TieBreak.GEOLOCATION)
|
||||
.description("mixy").build())
|
||||
.name("mixy").build())
|
||||
.add(DirectionalPool.builder()
|
||||
.zoneId("0000000000000002")
|
||||
.id("000000000000000B")
|
||||
.name("geo.jclouds.org.").build()).build());
|
||||
.dname("geo.jclouds.org.").build()).build());
|
||||
}
|
||||
}
|
|
@ -52,17 +52,17 @@ public class GetRRLoadBalancingPoolsByZoneResponseTest extends BaseHandlerTest {
|
|||
.add(RoundRobinPool.builder()
|
||||
.zoneId("0000000000000001")
|
||||
.id("000000000000002")
|
||||
.name("app-uswest1.jclouds.org.")
|
||||
.name("uswest1")
|
||||
.dname("app-uswest1.jclouds.org.").build())
|
||||
.add(RoundRobinPool.builder()
|
||||
.zoneId("0000000000000001")
|
||||
.id("000000000000003")
|
||||
.name("app-uswest2.jclouds.org.")
|
||||
.name("uswest2")
|
||||
.dname("app-uswest2.jclouds.org.").build())
|
||||
.add(RoundRobinPool.builder()
|
||||
.zoneId("0000000000000001")
|
||||
.id("000000000000004")
|
||||
.name("app-euwest.jclouds.org.")
|
||||
.name("euwest")
|
||||
.dname("app-euwest.jclouds.org.").build()).build());
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ import java.io.InputStream;
|
|||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
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.testng.annotations.Test;
|
||||
|
||||
|
@ -43,16 +43,16 @@ public class GetResourceRecordsOfDNameByTypeResponseTest extends BaseHandlerTest
|
|||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/records_by_name_and_type.xml");
|
||||
|
||||
FluentIterable<ResourceRecordMetadata> expected = expected();
|
||||
FluentIterable<ResourceRecordDetail> expected = expected();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
public FluentIterable<ResourceRecordMetadata> expected() {
|
||||
ResourceRecordMetadata record = ResourceRecordMetadata.builder()
|
||||
public FluentIterable<ResourceRecordDetail> expected() {
|
||||
ResourceRecordDetail record = ResourceRecordDetail.builder()
|
||||
.zoneId("03053D8E57C7A22A")
|
||||
.guid("04053D8E57C7A22F")
|
||||
.zoneName("adrianc.rr.ultradnstest.jclouds.org.")
|
||||
|
|
|
@ -25,8 +25,8 @@ import java.io.InputStream;
|
|||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata;
|
||||
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata.Builder;
|
||||
import org.jclouds.ultradns.ws.domain.ResourceRecordDetail;
|
||||
import org.jclouds.ultradns.ws.domain.ResourceRecordDetail.Builder;
|
||||
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -45,17 +45,17 @@ public class GetResourceRecordsOfResourceRecordResponseTest extends BaseHandlerT
|
|||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/records.xml");
|
||||
|
||||
FluentIterable<ResourceRecordMetadata> expected = expected();
|
||||
FluentIterable<ResourceRecordDetail> expected = expected();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
public FluentIterable<ResourceRecordMetadata> expected() {
|
||||
Builder builder = ResourceRecordMetadata.builder().zoneId("0000000000000001").zoneName("jclouds.org.");
|
||||
ImmutableList<ResourceRecordMetadata> records = ImmutableList.<ResourceRecordMetadata> builder()
|
||||
public FluentIterable<ResourceRecordDetail> expected() {
|
||||
Builder builder = ResourceRecordDetail.builder().zoneId("0000000000000001").zoneName("jclouds.org.");
|
||||
ImmutableList<ResourceRecordDetail> records = ImmutableList.<ResourceRecordDetail> builder()
|
||||
.add(builder.guid("04023A2507B6468F")
|
||||
.created(dateService.iso8601DateParse("2010-10-02T16:57:16.000Z"))
|
||||
.modified(dateService.iso8601DateParse("2011-09-27T23:49:21.000Z"))
|
||||
|
|
|
@ -52,7 +52,7 @@ public class GetTCLoadBalancingPoolsByZoneResponseTest extends BaseHandlerTest {
|
|||
.add(TrafficControllerPool.builder()
|
||||
.zoneId("0000000000000001")
|
||||
.id("000000000000002")
|
||||
.name("us-west-1c.discovery.jclouds.org.")
|
||||
.name("us-west-1c")
|
||||
.dname("us-west-1c.discovery.jclouds.org.")
|
||||
.statusCode(1)
|
||||
.failOverEnabled(true)
|
||||
|
|
|
@ -18,14 +18,15 @@
|
|||
*/
|
||||
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 java.io.InputStream;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord;
|
||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord.Status;
|
||||
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler;
|
||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecordDetail;
|
||||
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordDetailListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
@ -40,38 +41,36 @@ public class GetTCPoolRecordsResponseTest extends BaseHandlerTest {
|
|||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/tcrecords.xml");
|
||||
|
||||
FluentIterable<TrafficControllerPoolRecord> expected = expected();
|
||||
FluentIterable<TrafficControllerPoolRecordDetail> expected = expected();
|
||||
|
||||
TrafficControllerPoolRecordListHandler handler = injector.getInstance(TrafficControllerPoolRecordListHandler.class);
|
||||
FluentIterable<TrafficControllerPoolRecord> result = factory.create(handler).parse(is);
|
||||
TrafficControllerPoolRecordDetailListHandler handler = injector.getInstance(TrafficControllerPoolRecordDetailListHandler.class);
|
||||
FluentIterable<TrafficControllerPoolRecordDetail> result = factory.create(handler).parse(is);
|
||||
|
||||
assertEquals(result.toSet().toString(), expected.toSet().toString());
|
||||
}
|
||||
|
||||
public FluentIterable<TrafficControllerPoolRecord> expected() {
|
||||
return FluentIterable.from(ImmutableSet.<TrafficControllerPoolRecord> builder()
|
||||
.add(TrafficControllerPoolRecord.builder()
|
||||
public FluentIterable<TrafficControllerPoolRecordDetail> expected() {
|
||||
return FluentIterable.from(ImmutableSet.<TrafficControllerPoolRecordDetail> builder()
|
||||
.add(TrafficControllerPoolRecordDetail.builder()
|
||||
.id("0000000000000001")
|
||||
.poolId("0000000000000001")
|
||||
.pointsTo("canary.jclouds.org.")
|
||||
.record(createCNAME("canary.jclouds.org."))
|
||||
.weight(2)
|
||||
.priority(2)
|
||||
.type("CNAME")
|
||||
.forceAnswer("Normal")
|
||||
.probingEnabled(true)
|
||||
.status(Status.OK)
|
||||
.status(OK)
|
||||
.serving(true)
|
||||
.description("canary app").build())
|
||||
.add(TrafficControllerPoolRecord.builder()
|
||||
.add(TrafficControllerPoolRecordDetail.builder()
|
||||
.id("0000000000000002")
|
||||
.poolId("0000000000000001")
|
||||
.pointsTo("prod.jclouds.org.")
|
||||
.record(createCNAME("prod.jclouds.org."))
|
||||
.weight(98)
|
||||
.priority(1)
|
||||
.type("CNAME")
|
||||
.forceAnswer("Normal")
|
||||
.probingEnabled(true)
|
||||
.status(Status.OK)
|
||||
.status(OK)
|
||||
.serving(true)
|
||||
.description("prod app").build())
|
||||
.build());
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -18,14 +18,15 @@
|
|||
*/
|
||||
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.recordIdEqualTo;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
|
||||
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.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -53,13 +54,12 @@ public class TrafficControllerPoolPredicatesTest {
|
|||
assertFalse(idEqualTo("000000000000003").apply(pool));
|
||||
}
|
||||
|
||||
TrafficControllerPoolRecord record = TrafficControllerPoolRecord.builder()
|
||||
TrafficControllerPoolRecordDetail record = TrafficControllerPoolRecordDetail.builder()
|
||||
.id("0000000000000001")
|
||||
.poolId("0000000000000001")
|
||||
.pointsTo("canary.jclouds.org.")
|
||||
.record(createCNAME("canary.jclouds.org."))
|
||||
.weight(2)
|
||||
.priority(2)
|
||||
.type("CNAME")
|
||||
.forceAnswer("Normal")
|
||||
.probingEnabled(true)
|
||||
.status(Status.OK)
|
||||
|
|
|
@ -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>
|
|
@ -4,17 +4,17 @@
|
|||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<LBPoolList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
|
||||
<ns2:LBPoolData zoneid="0000000000000001">
|
||||
<ns2:PoolData PoolName="app-uswest1.jclouds.org."
|
||||
<ns2:PoolData description="uswest1"
|
||||
PoolId="000000000000002" PoolType="RD" PoolDName="app-uswest1.jclouds.org."
|
||||
ResponseMethod="RR" />
|
||||
</ns2:LBPoolData>
|
||||
<ns2:LBPoolData zoneid="0000000000000001">
|
||||
<ns2:PoolData PoolName="app-uswest2.jclouds.org."
|
||||
<ns2:PoolData description="uswest2"
|
||||
PoolId="000000000000003" PoolType="RD" PoolDName="app-uswest2.jclouds.org."
|
||||
ResponseMethod="RR" />
|
||||
</ns2:LBPoolData>
|
||||
<ns2:LBPoolData zoneid="0000000000000001">
|
||||
<ns2:PoolData PoolName="app-euwest.jclouds.org."
|
||||
<ns2:PoolData description="euwest"
|
||||
PoolId="000000000000004" PoolType="RD" PoolDName="app-euwest.jclouds.org."
|
||||
ResponseMethod="RR" />
|
||||
</ns2:LBPoolData>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<LBPoolList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
|
||||
<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"
|
||||
PoolDName="us-west-1c.discovery.jclouds.org." FailOver="Enabled"
|
||||
Probing="Enabled" MaxActiveServers="0" />
|
||||
|
|
Loading…
Reference in New Issue