Merge pull request #1392 from jclouds/ultradns-rrpool

added Round Robin Pool features to UltraDNS
This commit is contained in:
Adrian Cole 2013-03-07 14:47:08 -08:00
commit f994fdfc17
31 changed files with 724 additions and 737 deletions

View File

@ -21,7 +21,7 @@ package org.jclouds.ultradns.ws;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.ultradns.ws.domain.Account;
import org.jclouds.ultradns.ws.features.LBPoolApi;
import org.jclouds.ultradns.ws.features.RoundRobinPoolApi;
import org.jclouds.ultradns.ws.features.ResourceRecordApi;
import org.jclouds.ultradns.ws.features.TaskApi;
import org.jclouds.ultradns.ws.features.ZoneApi;
@ -56,13 +56,13 @@ public interface UltraDNSWSApi {
ResourceRecordApi getResourceRecordApiForZone(@PayloadParam("zoneName") String zoneName);
/**
* Provides synchronous access to Load Balancing Pool features.
* Provides synchronous access to Round Robin Pool features.
*
* @param zoneName
* zoneName including a trailing dot
*/
@Delegate
LBPoolApi getLBPoolApiForZone(@PayloadParam("zoneName") String zoneName);
RoundRobinPoolApi getRoundRobinPoolApiForZone(@PayloadParam("zoneName") String zoneName);
/**
* Provides synchronous access to Task features.

View File

@ -28,7 +28,7 @@ import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.ultradns.ws.domain.Account;
import org.jclouds.ultradns.ws.features.LBPoolAsyncApi;
import org.jclouds.ultradns.ws.features.RoundRobinPoolAsyncApi;
import org.jclouds.ultradns.ws.features.ResourceRecordAsyncApi;
import org.jclouds.ultradns.ws.features.TaskAsyncApi;
import org.jclouds.ultradns.ws.features.ZoneAsyncApi;
@ -74,13 +74,13 @@ public interface UltraDNSWSAsyncApi {
ResourceRecordAsyncApi getResourceRecordApiForZone(@PayloadParam("zoneName") String zoneName);
/**
* Provides asynchronous access to Load Balancing Pool features.
* Provides asynchronous access to Round Robin Pool features.
*
* @param zoneName
* zoneName including a trailing dot
*/
@Delegate
LBPoolAsyncApi getLBPoolApiForZone(@PayloadParam("zoneName") String zoneName);
RoundRobinPoolAsyncApi getRoundRobinPoolApiForZone(@PayloadParam("zoneName") String zoneName);
/**
* Provides asynchronous access to Task features.

View File

@ -29,8 +29,8 @@ import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule;
import org.jclouds.ultradns.ws.UltraDNSWSApi;
import org.jclouds.ultradns.ws.UltraDNSWSAsyncApi;
import org.jclouds.ultradns.ws.features.LBPoolApi;
import org.jclouds.ultradns.ws.features.LBPoolAsyncApi;
import org.jclouds.ultradns.ws.features.RoundRobinPoolApi;
import org.jclouds.ultradns.ws.features.RoundRobinPoolAsyncApi;
import org.jclouds.ultradns.ws.features.ResourceRecordApi;
import org.jclouds.ultradns.ws.features.ResourceRecordAsyncApi;
import org.jclouds.ultradns.ws.features.TaskApi;
@ -52,7 +52,7 @@ public class UltraDNSWSRestClientModule extends RestClientModule<UltraDNSWSApi,
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
.put(ZoneApi.class, ZoneAsyncApi.class)
.put(ResourceRecordApi.class, ResourceRecordAsyncApi.class)
.put(LBPoolApi.class, LBPoolAsyncApi.class)
.put(RoundRobinPoolApi.class, RoundRobinPoolAsyncApi.class)
.put(TaskApi.class, TaskAsyncApi.class).build();
public UltraDNSWSRestClientModule() {

View File

@ -1,168 +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;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects;
/**
*
* @author Adrian Cole
*/
public final class PoolRecord {
private final String poolId;
private final String id;
private final String description;
private final String type;
private final String pointsTo;
private PoolRecord(String poolId, String id, String description, String type, String pointsTo) {
this.poolId = checkNotNull(poolId, "poolId");
this.id = checkNotNull(id, "id");
this.description = checkNotNull(description, "description for %s", id);
this.type = checkNotNull(type, "type for %s", description);
this.pointsTo = checkNotNull(pointsTo, "pointsTo for %s", description);
}
/**
* The ID of the pool.
*/
public String getPoolId() {
return poolId;
}
/**
* The ID of the record.
*/
public String getId() {
return id;
}
/**
* The description of the record. ex. {@code SiteBacker pool via API}
*/
public String getDescription() {
return description;
}
/**
* The type of the record ex. ex. {@code A}
*/
public String getType() {
return type;
}
/**
* What the record points to ex. {@code 172.16.8.1}
*/
public String getPointsTo() {
return pointsTo;
}
@Override
public int hashCode() {
return Objects.hashCode(poolId, id, description, type, pointsTo);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PoolRecord that = PoolRecord.class.cast(obj);
return Objects.equal(this.poolId, that.poolId) && Objects.equal(this.id, that.id)
&& Objects.equal(this.description, that.description) && Objects.equal(this.type, that.type)
&& Objects.equal(this.pointsTo, that.pointsTo);
}
@Override
public String toString() {
return Objects.toStringHelper(this).omitNullValues().add("poolId", poolId).add("id", id).add("description", description)
.add("type", type).add("pointsTo", pointsTo).toString();
}
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return builder().from(this);
}
public final static class Builder {
private String poolId;
private String id;
private String description;
private String type;
private String pointsTo;
/**
* @see PoolRecord#getPoolId()
*/
public Builder poolId(String poolId) {
this.poolId = poolId;
return this;
}
/**
* @see PoolRecord#getId()
*/
public Builder id(String id) {
this.id = id;
return this;
}
/**
* @see PoolRecord#getDescription()
*/
public Builder description(String description) {
this.description = description;
return this;
}
/**
* @see PoolRecord#getType()
*/
public Builder type(String type) {
this.type = type;
return this;
}
/**
* @see PoolRecord#getPointsTo()
*/
public Builder pointsTo(String pointsTo) {
this.pointsTo = pointsTo;
return this;
}
public PoolRecord build() {
return new PoolRecord(poolId, id, description, type, pointsTo);
}
public Builder from(PoolRecord in) {
return this.poolId(in.poolId).id(in.id).description(in.description).type(in.type).pointsTo(in.pointsTo);
}
}
}

View File

@ -21,26 +21,23 @@ package org.jclouds.ultradns.ws.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
/**
*
* @author Adrian Cole
*/
public final class LBPool {
public final class RoundRobinPool {
private final String zoneId;
private final String id;
private final String name;
private final Type type;
private final Optional<Type> responseMethod;
private final String dname;
private LBPool(String zoneId, String id, String name, Type type, Optional<Type> responseMethod) {
private RoundRobinPool(String zoneId, String id, String name, String dname) {
this.zoneId = checkNotNull(zoneId, "zoneId");
this.id = checkNotNull(id, "id");
this.name = checkNotNull(name, "name for %s", id);
this.type = checkNotNull(type, "type for %s", name);
this.responseMethod = checkNotNull(responseMethod, "responseMethod for %s", name);
this.dname = checkNotNull(dname, "dname for %s", id);
}
/**
@ -58,29 +55,22 @@ public final class LBPool {
}
/**
* The name of the pool. ex. {@code jclouds.org.}
* The name of the pool. ex. {@code My Pool}
*/
public String getName() {
return name;
}
/**
* The type of the pool
* The dname of the pool. ex. {@code jclouds.org.}
*/
public Type getType() {
return type;
}
/**
* The response method
*/
public Optional<Type> getResponseMethod() {
return responseMethod;
public String getDName() {
return dname;
}
@Override
public int hashCode() {
return Objects.hashCode(zoneId, id, name, type, responseMethod);
return Objects.hashCode(zoneId, id, name, dname);
}
@Override
@ -91,29 +81,15 @@ public final class LBPool {
return false;
if (getClass() != obj.getClass())
return false;
LBPool that = LBPool.class.cast(obj);
RoundRobinPool that = RoundRobinPool.class.cast(obj);
return Objects.equal(this.zoneId, that.zoneId) && Objects.equal(this.id, that.id)
&& Objects.equal(this.name, that.name) && Objects.equal(this.type, that.type)
&& Objects.equal(this.responseMethod, that.responseMethod);
&& 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", name)
.add("type", type).add("responseMethod", responseMethod.orNull()).toString();
}
public static enum Type {
RD, RR, SB, TC, UNRECOGNIZED;
public static Type fromValue(String type) {
try {
return valueOf(checkNotNull(type, "type"));
} catch (IllegalArgumentException e) {
return UNRECOGNIZED;
}
}
.add("dname", dname).toString();
}
public static Builder builder() {
@ -128,11 +104,10 @@ public final class LBPool {
private String zoneId;
private String id;
private String name;
private Type type;
private Optional<Type> responseMethod = Optional.absent();
private String dname;
/**
* @see LBPool#getZoneId()
* @see RoundRobinPool#getZoneId()
*/
public Builder zoneId(String zoneId) {
this.zoneId = zoneId;
@ -140,7 +115,7 @@ public final class LBPool {
}
/**
* @see LBPool#getId()
* @see RoundRobinPool#getId()
*/
public Builder id(String id) {
this.id = id;
@ -148,7 +123,7 @@ public final class LBPool {
}
/**
* @see LBPool#getName()
* @see RoundRobinPool#getName()
*/
public Builder name(String name) {
this.name = name;
@ -156,27 +131,19 @@ public final class LBPool {
}
/**
* @see LBPool#getType()
* @see RoundRobinPool#getDName()
*/
public Builder type(Type type) {
this.type = type;
public Builder dname(String dname) {
this.dname = dname;
return this;
}
/**
* @see LBPool#getResponseMethod()
*/
public Builder responseMethod(Type responseMethod) {
this.responseMethod = Optional.fromNullable(responseMethod);
return this;
public RoundRobinPool build() {
return new RoundRobinPool(zoneId, id, name, dname);
}
public LBPool build() {
return new LBPool(zoneId, id, name, type, responseMethod);
}
public Builder from(LBPool in) {
return this.zoneId(in.zoneId).id(in.id).name(in.name).type(in.type).responseMethod(in.responseMethod.orNull());
public Builder from(RoundRobinPool in) {
return this.zoneId(in.zoneId).id(in.id).name(in.name).dname(in.dname);
}
}
}

View File

@ -1,66 +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.features;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.ultradns.ws.domain.LBPool;
import org.jclouds.ultradns.ws.domain.LBPool.Type;
import org.jclouds.ultradns.ws.domain.PoolRecord;
import com.google.common.collect.FluentIterable;
/**
* @see LBPoolAsyncApi
* @author Adrian Cole
*/
public interface LBPoolApi {
/**
* Returns all pools in the zone.
*
* @throws ResourceNotFoundException
* if the zone doesn't exist
*/
FluentIterable<LBPool> list() throws ResourceNotFoundException;
/**
* Returns all records in the pool.
*
* @throws ResourceNotFoundException
* if the pool doesn't exist
*/
FluentIterable<PoolRecord> listRecords(String poolId) throws ResourceNotFoundException;
/**
* Returns all pools with the specified {@link LBPool#getType()}
*
* @param type
* the {@link LBPool#getType() type}
* @throws ResourceNotFoundException
* if the zone doesn't exist
*/
FluentIterable<LBPool> listByType(Type type) throws ResourceNotFoundException;
/**
* removes a pool and all its records and probes
*
* @param id the {@link LBPool#getId() id}
*/
void delete(String id);
}

View File

@ -1,88 +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.features;
import javax.inject.Named;
import javax.ws.rs.POST;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.ultradns.ws.domain.LBPool;
import org.jclouds.ultradns.ws.domain.LBPool.Type;
import org.jclouds.ultradns.ws.domain.PoolRecord;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.LBPoolListHandler;
import org.jclouds.ultradns.ws.xml.PoolRecordListHandler;
import com.google.common.collect.FluentIterable;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see LBPoolApi
* @see <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @author Adrian Cole
*/
@RequestFilters(SOAPWrapWithPasswordAuth.class)
@VirtualHost
public interface LBPoolAsyncApi {
/**
* @see LBPoolApi#list()
*/
@Named("getLoadBalancingPoolsByZone")
@POST
@XMLResponseParser(LBPoolListHandler.class)
@Payload("<v01:getLoadBalancingPoolsByZone><zoneName>{zoneName}</zoneName><lbPoolType>all</lbPoolType></v01:getLoadBalancingPoolsByZone>")
ListenableFuture<FluentIterable<LBPool>> list() throws ResourceNotFoundException;
/**
* @see LBPoolApi#listRecords(String)
*/
@Named("getPoolRecords")
@POST
@XMLResponseParser(PoolRecordListHandler.class)
@Payload("<v01:getPoolRecords><poolId>{poolId}</poolId></v01:getPoolRecords>")
ListenableFuture<FluentIterable<PoolRecord>> listRecords(@PayloadParam("poolId") String poolId) throws ResourceNotFoundException;
/**
* @see LBPoolApi#listByType(String)
*/
@Named("getLoadBalancingPoolsByZone")
@POST
@XMLResponseParser(LBPoolListHandler.class)
@Payload("<v01:getLoadBalancingPoolsByZone><zoneName>{zoneName}</zoneName><lbPoolType>{type}</lbPoolType></v01:getLoadBalancingPoolsByZone>")
ListenableFuture<FluentIterable<LBPool>> listByType(@PayloadParam("type") Type type)
throws ResourceNotFoundException;
/**
* @see LBPoolApi#delete(String)
*/
@Named("deleteLBPool")
@POST
@Payload("<v01:deleteLBPool><transactionID /><lbPoolID>{lbPoolID}</lbPoolID><DeleteAll>Yes</DeleteAll></v01:deleteLBPool>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> delete(@PayloadParam("lbPoolID") String id);
}

View File

@ -107,7 +107,7 @@ public interface ResourceRecordApi {
throws ResourceNotFoundException;
/**
* deletes a specific resource record/
* deletes a specific resource record
*
* @param guid
* the global unique identifier for the resource record {@see

View File

@ -0,0 +1,146 @@
/**
* 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.features;
import org.jclouds.rest.ResourceNotFoundException;
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.RoundRobinPool;
import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
/**
* @see RoundRobinPoolAsyncApi
* @author Adrian Cole
*/
public interface RoundRobinPoolApi {
/**
* creates a round robin pool for {@code A} (ipv4) records
*
* @param name
* {@link RoundRobinPool#getName() name} of the RR pool
* @param hostname
* {@link RoundRobinPool#getDName() dname} of the RR pool {ex.
* www.jclouds.org.}
* @return the {@code guid} of the new record
* @throws ResourceAlreadyExistsException
* if a pool already exists with the same attrs
*/
String createAPoolForHostname(String name, String hostname) throws ResourceAlreadyExistsException;
/**
* adds a new {@code A} record to the pool
*
* @param lbPoolID
* the pool to add the record to.
* @param ipv4Address
* the ipv4 address
* @param ttl
* the {@link ResourceRecord#getTTL ttl} of the record
* @return the {@code guid} of the new record
* @throws ResourceAlreadyExistsException
* if a record already exists with the same attrs
*/
String addARecordWithAddressAndTTL(String lbPoolID, String ipv4Address, UnsignedInteger ttl)
throws ResourceAlreadyExistsException;
/**
* creates a round robin pool for {@code AAAA} (ipv6) records
*
* @param name
* {@link RoundRobinPool#getName() name} of the RR pool
* @param hostname
* {@link RoundRobinPool#getDName() hostname} {ex.
* www.jclouds.org.}
* @return the {@code guid} of the new record
* @throws ResourceAlreadyExistsException
* if a pool already exists with the same attrs
*/
String createAAAAPoolForHostname(String name, String hostname) throws ResourceAlreadyExistsException;
/**
* adds a new {@code AAAA} record to the pool
*
* @param lbPoolID
* the pool to add the record to.
* @param ipv6Address
* the ipv6 address
* @param ttl
* the {@link ResourceRecord#getTTL ttl} of the record
* @return the {@code guid} of the new record
* @throws ResourceAlreadyExistsException
* if a record already exists with the same attrs
*/
String addAAAARecordWithAddressAndTTL(String lbPoolID, String ipv6Address, UnsignedInteger ttl)
throws ResourceAlreadyExistsException;
/**
* updates an existing A or AAAA record in the pool.
*
* @param lbPoolID
* the pool to add the record to.
* @param guid
* the global unique identifier for the resource record {@see
* ResourceRecordMetadata#getGuid()}
* @param address
* the ipv4 or ipv6 address
* @param ttl
* the {@link ResourceRecord#getTTL ttl} of the record
*
* @throws ResourceNotFoundException
* if the guid doesn't exist
*/
void updateRecordWithAddressAndTTL(String lbPoolID, String guid, String address, UnsignedInteger ttl)
throws ResourceNotFoundException;
/**
* Returns all round robin pools in the zone.
*
* @throws ResourceNotFoundException
* if the zone doesn't exist
*/
FluentIterable<RoundRobinPool> list() throws ResourceNotFoundException;
/**
* Returns all records in the round robin pool.
*
* @throws ResourceNotFoundException
* if the pool doesn't exist
*/
FluentIterable<ResourceRecordMetadata> listRecords(String poolId) throws ResourceNotFoundException;
/**
* deletes a specific pooled resource record
*
* @param guid
* the global unique identifier for the resource record {@see
* ResourceRecordMetadata#getGuid()}
*/
void deleteRecord(String guid);
/**
* removes a pool and all its records and probes
*
* @param id
* the {@link RoundRobinPool#getId() id}
*/
void delete(String id);
}

View File

@ -0,0 +1,143 @@
/**
* 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.features;
import javax.inject.Named;
import javax.ws.rs.POST;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
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.RoundRobinPool;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.GuidHandler;
import org.jclouds.ultradns.ws.xml.RRPoolIDHandler;
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler;
import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
import com.google.common.util.concurrent.ListenableFuture;
/**
* @see RoundRobinPoolApi
* @see <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @author Adrian Cole
*/
@RequestFilters(SOAPWrapWithPasswordAuth.class)
@VirtualHost
public interface RoundRobinPoolAsyncApi {
/**
* @see RoundRobinPoolApi#list()
*/
@Named("getLoadBalancingPoolsByZone")
@POST
@XMLResponseParser(RoundRobinPoolListHandler.class)
@Payload("<v01:getLoadBalancingPoolsByZone><zoneName>{zoneName}</zoneName><lbPoolType>RR</lbPoolType></v01:getLoadBalancingPoolsByZone>")
ListenableFuture<FluentIterable<RoundRobinPool>> list() throws ResourceNotFoundException;
/**
* @see RoundRobinPoolApi#listRecords(String)
*/
@Named("getRRPoolRecords")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getRRPoolRecords><lbPoolId>{poolId}</lbPoolId></v01:getRRPoolRecords>")
ListenableFuture<FluentIterable<ResourceRecord>> listRecords(@PayloadParam("poolId") String poolId)
throws ResourceNotFoundException;
/**
* @see RoundRobinPoolApi#createAPoolForHostname
*/
@Named("addRRLBPool")
@POST
@XMLResponseParser(RRPoolIDHandler.class)
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><rrGUID /></v01:addRRLBPool>")
ListenableFuture<String> createAPoolForHostname(@PayloadParam("description") String name,
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#addARecordWithAddressAndTTL
*/
@Named("addRecordToRRPool")
@POST
@XMLResponseParser(GuidHandler.class)
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
ListenableFuture<String> addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("address") String ipv4Address, @PayloadParam("ttl") UnsignedInteger ttl)
throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#updateRecordWithAddressAndTTL
*/
@Named("updateRecordOfRRPool")
@POST
@Payload("<v01:updateRecordOfRRPool><transactionID /><resourceRecord rrGuid=\"{guid}\" lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" TTL=\"{ttl}\"/></v01:updateRecordOfRRPool>")
ListenableFuture<Void> updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("guid") String guid, @PayloadParam("address") String ipv4Address,
@PayloadParam("ttl") UnsignedInteger ttl) throws ResourceNotFoundException;
/**
* @see RoundRobinPoolApi#deleteRecord(String)
*/
@Named("deleteRecordOfRRPool")
@POST
@Payload("<v01:deleteRecordOfRRPool><transactionID /><guid>{guid}</guid></v01:deleteRecordOfRRPool>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteRecord(@PayloadParam("guid") String guid);
/**
* @see RoundRobinPoolApi#createAAAAPoolForHostname
*/
@Named("addRRLBPool")
@POST
@XMLResponseParser(RRPoolIDHandler.class)
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool>")
ListenableFuture<String> createAAAAPoolForHostname(@PayloadParam("description") String name,
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#addAAAARecordWithAddressAndTTL
*/
@Named("addRecordToRRPool")
@POST
@XMLResponseParser(GuidHandler.class)
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
ListenableFuture<String> addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("address") String ipv6Address, @PayloadParam("ttl") UnsignedInteger ttl)
throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#delete(String)
*/
@Named("deleteLBPool")
@POST
@Payload("<v01:deleteLBPool><transactionID /><lbPoolID>{lbPoolID}</lbPoolID><DeleteAll>Yes</DeleteAll><retainRecordId /></v01:deleteLBPool>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> delete(@PayloadParam("lbPoolID") String id);
}

View File

@ -80,9 +80,11 @@ public class UltraDNSWSErrorHandler implements HttpErrorHandler {
case 1801:
case 2103:
case 2401:
case 2911:
return new ResourceNotFoundException(exception.getError().getDescription(), exception);
case 1802:
case 2111:
case 2912:
return new ResourceAlreadyExistsException(exception.getError().getDescription(), exception);
}
return exception;

View File

@ -1,59 +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.xml;
import static org.jclouds.util.SaxUtils.cleanseAttributes;
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import java.util.Map;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.ultradns.ws.domain.PoolRecord;
import org.xml.sax.Attributes;
/**
*
* @author Adrian Cole
*/
public class PoolRecordHandler extends ParseSax.HandlerForGeneratedRequestWithResult<PoolRecord> {
private PoolRecord poolRecord;
@Override
public PoolRecord getResult() {
try {
return poolRecord;
} finally {
poolRecord = null;
}
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attrs) {
Map<String, String> attributes = cleanseAttributes(attrs);
if (equalsOrSuffix(qName, "PoolRecordData")) {
poolRecord = PoolRecord.builder()
.poolId(attributes.get("poolId"))
.id(attributes.get("poolRecordID"))
.description(attributes.get("description"))
.type(attributes.get("recordType"))
.pointsTo(attributes.get("pointsTo")).build();
}
}
}

View File

@ -18,48 +18,43 @@
*/
package org.jclouds.ultradns.ws.xml;
import static org.jclouds.util.SaxUtils.currentOrNull;
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.ultradns.ws.domain.PoolRecord;
import org.xml.sax.Attributes;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.inject.Inject;
/**
*
* @author Adrian Cole
*/
public class PoolRecordListHandler extends ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<PoolRecord>> {
private final PoolRecordHandler zoneHandler;
private Builder<PoolRecord> zones = ImmutableSet.<PoolRecord> builder();
@Inject
public PoolRecordListHandler(PoolRecordHandler zoneHandler) {
this.zoneHandler = zoneHandler;
}
public class RRPoolIDHandler extends ParseSax.HandlerForGeneratedRequestWithResult<String> {
private StringBuilder currentText = new StringBuilder();
private String rrPoolID = null;
@Override
public FluentIterable<PoolRecord> getResult() {
return FluentIterable.from(zones.build());
public String getResult() {
try {
return rrPoolID;
} finally {
rrPoolID = null;
}
}
@Override
public void startElement(String url, String name, String qName, Attributes attributes) {
if (equalsOrSuffix(qName, "PoolRecordData")) {
zoneHandler.startElement(url, name, qName, attributes);
}
}
@Override
public void endElement(String uri, String name, String qName) {
if (equalsOrSuffix(qName, "PoolRecordData")) {
zones.add(zoneHandler.getResult());
if (equalsOrSuffix(qName, "RRPoolID")) {
rrPoolID = currentOrNull(currentText);
}
currentText = new StringBuilder();
}
@Override
public void characters(char ch[], int start, int length) {
currentText.append(ch, start, length);
}
}

View File

@ -24,25 +24,24 @@ import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import java.util.Map;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.ultradns.ws.domain.LBPool;
import org.jclouds.ultradns.ws.domain.LBPool.Builder;
import org.jclouds.ultradns.ws.domain.LBPool.Type;
import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import org.jclouds.ultradns.ws.domain.RoundRobinPool.Builder;
import org.xml.sax.Attributes;
/**
*
* @author Adrian Cole
*/
public class LBPoolHandler extends ParseSax.HandlerForGeneratedRequestWithResult<LBPool> {
public class RoundRobinPoolHandler extends ParseSax.HandlerForGeneratedRequestWithResult<RoundRobinPool> {
private Builder pool = LBPool.builder();
private Builder pool = RoundRobinPool.builder();
@Override
public LBPool getResult() {
public RoundRobinPool getResult() {
try {
return pool.build();
} finally {
pool = LBPool.builder();
pool = RoundRobinPool.builder();
}
}
@ -52,10 +51,7 @@ public class LBPoolHandler extends ParseSax.HandlerForGeneratedRequestWithResult
if (equalsOrSuffix(qName, "LBPoolData")) {
pool.zoneId(attributes.get("zoneid"));
} else if (equalsOrSuffix(qName, "PoolData")) {
Type responseMethod = attributes.containsKey("ResponseMethod") ? Type.fromValue(attributes
.get("ResponseMethod")) : null;
pool.id(attributes.get("PoolId")).name(attributes.get("PoolName"))
.type(Type.fromValue(attributes.get("PoolType"))).responseMethod(responseMethod);
pool.id(attributes.get("PoolId")).name(attributes.get("PoolName")).dname(attributes.get("PoolDName"));
}
}
}

View File

@ -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.LBPool;
import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import org.xml.sax.Attributes;
import com.google.common.collect.FluentIterable;
@ -33,19 +33,19 @@ import com.google.inject.Inject;
*
* @author Adrian Cole
*/
public class LBPoolListHandler extends ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<LBPool>> {
public class RoundRobinPoolListHandler extends ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<RoundRobinPool>> {
private final LBPoolHandler poolHandler;
private final RoundRobinPoolHandler poolHandler;
private Builder<LBPool> pools = ImmutableSet.<LBPool> builder();
private Builder<RoundRobinPool> pools = ImmutableSet.<RoundRobinPool> builder();
@Inject
public LBPoolListHandler(LBPoolHandler poolHandler) {
public RoundRobinPoolListHandler(RoundRobinPoolHandler poolHandler) {
this.poolHandler = poolHandler;
}
@Override
public FluentIterable<LBPool> getResult() {
public FluentIterable<RoundRobinPool> getResult() {
return FluentIterable.from(pools.build());
}

View File

@ -1,103 +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.features;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertTrue;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.ultradns.ws.domain.Account;
import org.jclouds.ultradns.ws.domain.LBPool;
import org.jclouds.ultradns.ws.domain.LBPool.Type;
import org.jclouds.ultradns.ws.domain.PoolRecord;
import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "live", singleThreaded = true, testName = "LBPoolApiLiveTest")
public class LBPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
private Account account;
@Override
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
account = context.getApi().getCurrentAccount();
}
private void checkLBPool(LBPool pool) {
checkNotNull(pool.getZoneId(), "ZoneId cannot be null for a LBPool %s", pool);
checkNotNull(pool.getId(), "Id cannot be null for a LBPool %s", pool);
checkNotNull(pool.getName(), "Name cannot be null for a LBPool %s", pool);
checkNotNull(pool.getType(), "Type cannot be null for a LBPool %s", pool);
checkNotNull(pool.getResponseMethod(), "ResponseMethod cannot be null for a LBPool %s", pool);
}
private void checkPoolRecord(PoolRecord record) {
checkNotNull(record.getPoolId(), "PoolId cannot be null for a PoolRecord %s", record);
checkNotNull(record.getId(), "Id cannot be null for a PoolRecord %s", record);
checkNotNull(record.getDescription(), "Description cannot be null for a PoolRecord %s", record);
checkNotNull(record.getPointsTo(), "PointsTo cannot be null for a PoolRecord %s", record);
checkNotNull(record.getType(), "Type cannot be null for a PoolRecord %s", record);
}
@Test
public void testListLBPools() {
for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) {
for (LBPool pool : api(zone.getName()).list()) {
checkLBPool(pool);
}
}
}
@Test
public void testListLBPoolsByType() {
for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) {
for (LBPool pool : api(zone.getName()).list()) {
assertTrue(api(zone.getName()).listByType(pool.getType()).contains(pool));
break;
}
}
}
@Test
public void testListLBPoolRecords() {
for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) {
for (LBPool pool : api(zone.getName()).listByType(Type.RR)) {
for (PoolRecord record : api(zone.getName()).listRecords(pool.getId())) {
checkPoolRecord(record);
}
}
}
}
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Zone does not exist in the system.")
public void testListLBPoolsWhenZoneIdNotFound() {
api("AAAAAAAAAAAAAAAA").list();
}
private LBPoolApi api(String zoneName) {
return context.getApi().getLBPoolApiForZone(zoneName);
}
}

View File

@ -74,7 +74,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
super.tearDownContext();
}
private void checkResourceRecord(ResourceRecord rr) {
static void checkResourceRecord(ResourceRecord rr) {
checkNotNull(rr.getName(), "DName cannot be null for a ResourceRecord %s", rr);
checkNotNull(rr.getType(), "Type cannot be null for a ResourceRecord %s", rr);
assertTrue(rr.getType().intValue() > 0, "Type must be positive for a ResourceRecord " + rr);
@ -83,7 +83,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
checkNotNull(rr.getRData(), "InfoValues cannot be null for a ResourceRecord %s", rr);
}
private void checkResourceRecordMetadata(ResourceRecordMetadata rr) {
static void checkResourceRecordMetadata(ResourceRecordMetadata rr) {
checkNotNull(rr.getZoneId(), "ZoneId cannot be null for a ResourceRecordMetadata %s", rr);
checkNotNull(rr.getGuid(), "Guid cannot be null for a ResourceRecordMetadata %s", rr);
checkNotNull(rr.getZoneName(), "ZoneName cannot be null for a ResourceRecordMetadata %s", rr);
@ -152,7 +152,7 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
} catch (ResourceAlreadyExistsException e) {
}
assertTrue(listRRs(mx).anyMatch(equalTo(mx)));
assertTrue(listRRs().anyMatch(equalTo(mx)));
}
@Test(dependsOnMethods = "testCreateRecord")
@ -172,23 +172,23 @@ public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
public void testUpdateRecord() {
mx = mx.toBuilder().ttl(3600).build();
api(zoneName).update(guid, mx);
assertTrue(listRRs(mx).anyMatch(equalTo(mx)));
assertTrue(listRRs().anyMatch(equalTo(mx)));
}
@Test(dependsOnMethods = "testUpdateRecord")
public void testDeleteRecord() {
api(zoneName).delete(guid);
assertFalse(listRRs(mx).anyMatch(equalTo(mx)));
assertFalse(listRRs().anyMatch(equalTo(mx)));
}
private Function<ResourceRecordMetadata, ResourceRecord> toRecord = new Function<ResourceRecordMetadata, ResourceRecord>() {
static Function<ResourceRecordMetadata, ResourceRecord> toRecord = new Function<ResourceRecordMetadata, ResourceRecord>() {
public ResourceRecord apply(ResourceRecordMetadata in) {
checkResourceRecordMetadata(in);
return in.getRecord();
}
};
private FluentIterable<ResourceRecord> listRRs(ResourceRecord mx) {
private FluentIterable<ResourceRecord> listRRs() {
return api(zoneName).list().transform(toRecord);
}

View File

@ -23,61 +23,79 @@ import static org.testng.Assert.assertEquals;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.ultradns.ws.UltraDNSWSApi;
import org.jclouds.ultradns.ws.domain.LBPool.Type;
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiExpectTest;
import org.jclouds.ultradns.ws.parse.GetLoadBalancingPoolsByZoneResponseTest;
import org.jclouds.ultradns.ws.parse.GetPoolRecordsResponseTest;
import org.jclouds.ultradns.ws.parse.GetResourceRecordsOfResourceRecordResponseTest;
import org.testng.annotations.Test;
/**
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "LBPoolApiExpectTest")
public class LBPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
@Test(groups = "unit", testName = "RoundRobinPoolApiExpectTest")
public class RoundRobinPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
HttpRequest createA = HttpRequest.builder().method("POST")
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader("Host", "ultra-api.ultradns.com:8443")
.payload(payloadFromResourceWithContentType("/create_rrpool_a.xml", "application/xml")).build();
HttpRequest createAAAA = HttpRequest.builder().method("POST")
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader("Host", "ultra-api.ultradns.com:8443")
.payload(payloadFromResourceWithContentType("/create_rrpool_aaaa.xml", "application/xml")).build();
HttpResponse createResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/rrpool_created.xml", "application/xml")).build();
public void testCreateAWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(createA, createResponse);
assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForHostname("www.jclouds.org.", "foo"), "060339AA04175655");
}
public void testCreateAAAAWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(createAAAA, createResponse);
assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAAAAPoolForHostname("www.jclouds.org.", "foo"), "060339AA04175655");
}
HttpResponse alreadyCreated = HttpResponse.builder().statusCode(500)
.payload(payloadFromResourceWithContentType("/lbpool_already_exists.xml", "application/xml")).build();
@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");
}
HttpRequest list = HttpRequest.builder().method("POST")
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader("Host", "ultra-api.ultradns.com:8443")
.payload(payloadFromResourceWithContentType("/list_lbpools.xml", "application/xml")).build();
.payload(payloadFromResourceWithContentType("/list_rrpools.xml", "application/xml")).build();
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/lbpools.xml", "application/xml")).build();
.payload(payloadFromResourceWithContentType("/rrpools.xml", "application/xml")).build();
public void testListWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(list, listResponse);
assertEquals(
success.getLBPoolApiForZone("jclouds.org.").list().toString(),
new GetLoadBalancingPoolsByZoneResponseTest().expected().toString());
}
HttpRequest listByType = HttpRequest.builder().method("POST")
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader("Host", "ultra-api.ultradns.com:8443")
.payload(payloadFromResourceWithContentType("/list_lbpools_by_type.xml", "application/xml")).build();
public void testListByTypeWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(listByType, listResponse);
assertEquals(
success.getLBPoolApiForZone("jclouds.org.").listByType(Type.RD).toString(),
success.getRoundRobinPoolApiForZone("jclouds.org.").list().toString(),
new GetLoadBalancingPoolsByZoneResponseTest().expected().toString());
}
HttpRequest listRecords = HttpRequest.builder().method("POST")
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader("Host", "ultra-api.ultradns.com:8443")
.payload(payloadFromResourceWithContentType("/list_poolrecords.xml", "application/xml")).build();
.payload(payloadFromResourceWithContentType("/list_rrrecords.xml", "application/xml")).build();
HttpResponse listRecordsResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResourceWithContentType("/poolrecords.xml", "application/xml")).build();
.payload(payloadFromResourceWithContentType("/records.xml", "application/xml")).build();
public void testListRecordsWhenResponseIs2xx() {
UltraDNSWSApi success = requestSendsResponse(listRecords, listRecordsResponse);
assertEquals(
success.getLBPoolApiForZone("jclouds.org.").listRecords("04053D8E57C7931F").toString(),
new GetPoolRecordsResponseTest().expected().toString());
success.getRoundRobinPoolApiForZone("jclouds.org.").listRecords("04053D8E57C7931F").toString(),
new GetResourceRecordsOfResourceRecordResponseTest().expected().toString());
}
HttpRequest delete = HttpRequest.builder().method("POST")

View File

@ -0,0 +1,250 @@
/**
* 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.features;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.equalTo;
import static java.util.logging.Logger.getAnonymousLogger;
import static org.jclouds.ultradns.ws.domain.ResourceRecord.rrBuilder;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
import org.jclouds.ultradns.ws.domain.Account;
import org.jclouds.ultradns.ws.domain.ResourceRecord;
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata;
import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import org.jclouds.ultradns.ws.domain.Zone;
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.primitives.UnsignedInteger;
/**
* @author Adrian Cole
*/
@Test(groups = "live", singleThreaded = true, testName = "RoundRobinPoolApiLiveTest")
public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
private String zoneName = System.getProperty("user.name").replace('.', '-') + ".rrpool.ultradnstest.jclouds.org.";
private Account account;
@Override
@BeforeClass(groups = { "integration", "live" })
public void setupContext() {
super.setupContext();
context.getApi().getZoneApi().delete(zoneName);
account = context.getApi().getCurrentAccount();
context.getApi().getZoneApi().createInAccount(zoneName, account.getId());
}
private void checkLBPool(RoundRobinPool pool) {
checkNotNull(pool.getZoneId(), "ZoneId cannot be null for a RoundRobinPool %s", pool);
checkNotNull(pool.getId(), "Id cannot be null for a RoundRobinPool %s", pool);
checkNotNull(pool.getName(), "Name cannot be null for a RoundRobinPool %s", pool);
}
@Test
public void testListRRPools() {
for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) {
for (RoundRobinPool pool : api(zone.getName()).list()) {
checkLBPool(pool);
}
}
}
@Test
public void testListRRPoolRecords() {
for (Zone zone : context.getApi().getZoneApi().listByAccount(account.getId())) {
for (RoundRobinPool pool : api(zone.getName()).list()) {
for (ResourceRecordMetadata record : api(zone.getName()).listRecords(pool.getId())) {
ResourceRecordApiLiveTest.checkResourceRecordMetadata(record);
}
}
}
}
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Zone does not exist in the system.")
public void testListRRPoolsWhenZoneIdNotFound() {
api("AAAAAAAAAAAAAAAA").list();
}
@Test
public void testDeleteWhenNotFound() {
api(zoneName).delete("06063D9C54C5AE09");
}
String hostname = "www.rrpool." + zoneName;
String aPoolId;
@Test
public void testCreateAPool() {
aPoolId = api(zoneName).createAPoolForHostname("A pool", hostname);
getAnonymousLogger().info("created A rr pool: " + aPoolId);
try {
api(zoneName).createAPoolForHostname("A pool", hostname);
fail();
} catch (ResourceAlreadyExistsException e) {
}
Optional<RoundRobinPool> aPool = getPoolById(aPoolId);
assertTrue(aPool.isPresent());
assertEquals(aPool.get().getName(), "A pool");
assertEquals(aPool.get().getDName(), hostname);
}
String aRecord1;
String aRecord2;
@Test(dependsOnMethods = "testCreateAPool")
public void addARecordToPool() {
aRecord1 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", UnsignedInteger.ONE);
getAnonymousLogger().info("created A record: " + aRecord1);
assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("1.2.3.4").build())));
aRecord2 = api(zoneName).addARecordWithAddressAndTTL(aPoolId, "3.4.5.6", UnsignedInteger.ONE);
assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("3.4.5.6").build())));
getAnonymousLogger().info("created A record: " + aRecord1);
try {
api(zoneName).addARecordWithAddressAndTTL(aPoolId, "1.2.3.4", UnsignedInteger.ONE);
fail();
} catch (ResourceAlreadyExistsException e) {
}
}
@Test(dependsOnMethods = "addARecordToPool")
public void testUpdateRecord() {
api(zoneName).updateRecordWithAddressAndTTL(aPoolId, aRecord1, "1.1.1.1", UnsignedInteger.ZERO);
assertTrue(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("A").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("A").ttl(0).rdata("1.1.1.1").build())));
assertFalse(listRRs(aPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("A").ttl(1).rdata("3.4.5.6").build())));
}
@Test(dependsOnMethods = "testDeleteRecord")
public void testDeleteAPool() {
api(zoneName).delete(aPoolId);
assertFalse(getPoolById(aPoolId).isPresent());
}
private String aaaaPoolId;
@Test
public void testCreateAAAAPool() {
aaaaPoolId = api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname);
getAnonymousLogger().info("created AAAA rr pool: " + aaaaPoolId);
try {
api(zoneName).createAAAAPoolForHostname("AAAA pool", hostname);
fail();
} catch (ResourceAlreadyExistsException e) {
}
Optional<RoundRobinPool> aPool = getPoolById(aaaaPoolId);
assertTrue(aPool.isPresent());
assertEquals(aPool.get().getName(), "AAAA pool");
assertEquals(aPool.get().getDName(), hostname);
}
String aaaaRecord1;
String aaaaRecord2;
@Test(dependsOnMethods = "testCreateAAAAPool")
public void addAAAARecordToPool() {
aaaaRecord1 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334",
UnsignedInteger.ONE);
getAnonymousLogger().info("created AAAA record: " + aaaaRecord1);
assertTrue(listRRs(aaaaPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("AAAA").ttl(1).rdata("2001:0DB8:85A3:0000:0000:8A2E:0370:7334")
.build())));
aaaaRecord2 = api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2002:0DB8:85A3:0000:0000:8A2E:0370:7334",
UnsignedInteger.ONE);
assertTrue(listRRs(aaaaPoolId).anyMatch(
equalTo(rrBuilder().name(hostname).type("AAAA").ttl(1).rdata("2002:0DB8:85A3:0000:0000:8A2E:0370:7334")
.build())));
getAnonymousLogger().info("created AAAA record: " + aaaaRecord1);
try {
api(zoneName).addAAAARecordWithAddressAndTTL(aaaaPoolId, "2001:0DB8:85A3:0000:0000:8A2E:0370:7334",
UnsignedInteger.ONE);
fail();
} catch (ResourceAlreadyExistsException e) {
}
}
@Test(dependsOnMethods = "addAAAARecordToPool")
public void testDeleteAAAAPool() {
api(zoneName).delete(aaaaPoolId);
assertFalse(getPoolById(aaaaPoolId).isPresent());
}
protected Optional<RoundRobinPool> getPoolById(final String poolId) {
return api(zoneName).list().firstMatch(new Predicate<RoundRobinPool>() {
public boolean apply(RoundRobinPool in) {
return in.getId().equals(poolId);
}
});
}
private FluentIterable<ResourceRecord> listRRs(String poolId) {
return api(zoneName).listRecords(poolId).transform(ResourceRecordApiLiveTest.toRecord);
}
private RoundRobinPoolApi api(String zoneName) {
return context.getApi().getRoundRobinPoolApiForZone(zoneName);
}
@Override
@AfterClass(groups = { "integration", "live" })
protected void tearDownContext() {
if (aPoolId != null)
api(zoneName).delete(aPoolId);
if (aaaaPoolId != null)
api(zoneName).delete(aaaaPoolId);
context.getApi().getZoneApi().delete(zoneName);
super.tearDownContext();
}
}

View File

@ -176,6 +176,51 @@ public class UltraDNSWSErrorHandlerTest {
assertEquals(exception.getError().getCode(), 2111);
}
@Test
public void testCode2911SetsResourceNotFoundException() throws IOException {
HttpRequest request = HttpRequest.builder().method("POST")
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader("Host", "ultra-api.ultradns.com:8443").payload(payloadFromResource("/delete_lbpool.xml")).build();
HttpCommand command = new HttpCommand(request);
HttpResponse response = HttpResponse.builder().message("Server Error").statusCode(500)
.payload(payloadFromResource("/lbpool_doesnt_exist.xml")).build();
function.handleError(command, response);
assertEquals(command.getException().getClass(), ResourceNotFoundException.class);
assertEquals(command.getException().getMessage(), "Pool does not exist in the system");
UltraDNSWSResponseException exception = UltraDNSWSResponseException.class.cast(command.getException().getCause());
assertEquals(exception.getMessage(), "Error 2911: Pool does not exist in the system");
assertEquals(exception.getError().getDescription(), "Pool does not exist in the system");
assertEquals(exception.getError().getCode(), 2911);
}
@Test
public void testCode2912SetsResourceAlreadyExistsException() throws IOException {
HttpRequest request = HttpRequest.builder().method("POST")
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
.addHeader("Host", "ultra-api.ultradns.com:8443").payload(payloadFromResource("/create_rrpool_a.xml")).build();
HttpCommand command = new HttpCommand(request);
HttpResponse response = HttpResponse.builder().message("Server Error").statusCode(500)
.payload(payloadFromResource("/lbpool_already_exists.xml")).build();
function.handleError(command, response);
assertEquals(command.getException().getClass(), ResourceAlreadyExistsException.class);
assertEquals(command.getException().getMessage(),
"Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.");
UltraDNSWSResponseException exception = UltraDNSWSResponseException.class.cast(command.getException().getCause());
assertEquals(exception.getMessage(),
"Error 2912: Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.");
assertEquals(exception.getError().getDescription(),
"Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.");
assertEquals(exception.getError().getCode(), 2912);
}
private Payload payloadFromResource(String resource) {
try {
return payloadFromStringWithContentType(toStringAndClose(getClass().getResourceAsStream(resource)),

View File

@ -23,9 +23,8 @@ import static org.testng.Assert.assertEquals;
import java.io.InputStream;
import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.ultradns.ws.domain.LBPool;
import org.jclouds.ultradns.ws.domain.LBPool.Type;
import org.jclouds.ultradns.ws.xml.LBPoolListHandler;
import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler;
import org.testng.annotations.Test;
import com.google.common.collect.FluentIterable;
@ -38,40 +37,32 @@ import com.google.common.collect.ImmutableList;
public class GetLoadBalancingPoolsByZoneResponseTest extends BaseHandlerTest {
public void test() {
InputStream is = getClass().getResourceAsStream("/lbpools.xml");
InputStream is = getClass().getResourceAsStream("/rrpools.xml");
FluentIterable<LBPool> expected = expected();
FluentIterable<RoundRobinPool> expected = expected();
LBPoolListHandler handler = injector.getInstance(LBPoolListHandler.class);
FluentIterable<LBPool> result = factory.create(handler).parse(is);
RoundRobinPoolListHandler handler = injector.getInstance(RoundRobinPoolListHandler.class);
FluentIterable<RoundRobinPool> result = factory.create(handler).parse(is);
assertEquals(result.toSet().toString(), expected.toSet().toString());
}
public FluentIterable<LBPool> expected() {
return FluentIterable.from(ImmutableList.<LBPool> builder()
.add(LBPool.builder()
.zoneId("0000000000000001")
.id("000000000000001")
.name("us-west-1c.app.jclouds.org.")
.type(Type.TC).build())
.add(LBPool.builder()
public FluentIterable<RoundRobinPool> expected() {
return FluentIterable.from(ImmutableList.<RoundRobinPool> builder()
.add(RoundRobinPool.builder()
.zoneId("0000000000000001")
.id("000000000000002")
.name("app-uswest1.jclouds.org.")
.type(Type.RD)
.responseMethod(Type.RR).build())
.add(LBPool.builder()
.dname("app-uswest1.jclouds.org.").build())
.add(RoundRobinPool.builder()
.zoneId("0000000000000001")
.id("000000000000003")
.name("app-uswest2.jclouds.org.")
.type(Type.RD)
.responseMethod(Type.RR).build())
.add(LBPool.builder()
.dname("app-uswest2.jclouds.org.").build())
.add(RoundRobinPool.builder()
.zoneId("0000000000000001")
.id("000000000000004")
.name("app-euwest.jclouds.org.")
.type(Type.RD)
.responseMethod(Type.RR).build()).build());
.dname("app-euwest.jclouds.org.").build()).build());
}
}

View File

@ -1,65 +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.parse;
import static org.testng.Assert.assertEquals;
import java.io.InputStream;
import org.jclouds.http.functions.BaseHandlerTest;
import org.jclouds.ultradns.ws.domain.PoolRecord;
import org.jclouds.ultradns.ws.xml.PoolRecordListHandler;
import org.testng.annotations.Test;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableSet;
/**
* @author Adrian Cole
*/
@Test(testName = "GetPoolRecordsResponseTest")
public class GetPoolRecordsResponseTest extends BaseHandlerTest {
public void test() {
InputStream is = getClass().getResourceAsStream("/poolrecords.xml");
FluentIterable<PoolRecord> expected = expected();
PoolRecordListHandler handler = injector.getInstance(PoolRecordListHandler.class);
FluentIterable<PoolRecord> result = factory.create(handler).parse(is);
assertEquals(result.toSet().toString(), expected.toSet().toString());
}
public FluentIterable<PoolRecord> expected() {
return FluentIterable.from(ImmutableSet.<PoolRecord> builder()
.add(PoolRecord.builder()
.poolId("0603399D0413BC46")
.id("0603399D0413BC47")
.description("SiteBacker pool via API")
.type("A")
.pointsTo("172.16.8.1").build())
.add(PoolRecord.builder()
.poolId("0603399D0413BC46")
.id("060339A30416430C")
.description("SiteBacker pool via API")
.type("A")
.pointsTo("172.16.8.2").build()).build());
}
}

View File

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

View File

@ -0,0 +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:addRRLBPool><transactionID /><zoneName>jclouds.org.</zoneName><hostName>foo</hostName><description>www.jclouds.org.</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool></soapenv:Body></soapenv:Envelope>

View File

@ -0,0 +1 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Fault occurred while processing.</faultstring><detail><ns1:UltraWSException xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/"><errorCode xmlns:ns2="http://schema.ultraservice.neustar.com/v01/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:int">2912</errorCode><errorDescription xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Pool already created for this host name : www.rrpool.adrianc.rrpool.ultradnstest.jclouds.org.</errorDescription></ns1:UltraWSException></detail></soap:Fault></soap:Body></soap:Envelope>

View File

@ -1 +1 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Fault occurred while processing.</faultstring><detail><ns1:UltraWSException xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/"><errorCode xmlns:ns2="http://schema.ultraservice.neustar.com/v01/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:int">2103</errorCode><errorDescription xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">No Resource Record with GUID found in the system AAAAAAAAAAAAAAAA</errorDescription></ns1:UltraWSException></detail></soap:Fault></soap:Body></soap:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Fault occurred while processing.</faultstring><detail><ns1:UltraWSException xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/"><errorCode xmlns:ns2="http://schema.ultraservice.neustar.com/v01/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:int">2911</errorCode><errorDescription xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Pool does not exist in the system</errorDescription></ns1:UltraWSException></detail></soap:Fault></soap:Body></soap:Envelope>

View File

@ -1 +1 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:getLoadBalancingPoolsByZone><zoneName>jclouds.org.</zoneName><lbPoolType>RD</lbPoolType></v01:getLoadBalancingPoolsByZone></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:getLoadBalancingPoolsByZone><zoneName>jclouds.org.</zoneName><lbPoolType>RR</lbPoolType></v01:getLoadBalancingPoolsByZone></soapenv:Body></soapenv:Envelope>

View File

@ -1 +1 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:getPoolRecords><poolId>04053D8E57C7931F</poolId></v01:getPoolRecords></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:getRRPoolRecords><lbPoolId>04053D8E57C7931F</lbPoolId></v01:getRRPoolRecords></soapenv:Body></soapenv:Envelope>

View File

@ -1,18 +0,0 @@
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:getPoolRecordsResponse
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
<PoolRecordsList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
<ns2:PoolRecordData description="SiteBacker pool via API"
serving="No" status="Failure" probing="ENABLED" forceAnswer="Normal"
recordType="A" priority="1" pointsTo="172.16.8.1" poolId="0603399D0413BC46"
poolRecordID="0603399D0413BC47" />
<ns2:PoolRecordData description="SiteBacker pool via API"
serving="No" status="DISABLED" probing="ENABLED" forceAnswer="Normal"
recordType="A" priority="0" pointsTo="172.16.8.2" poolId="0603399D0413BC46"
poolRecordID="060339A30416430C" />
</PoolRecordsList>
</ns1:getPoolRecordsResponse>
</soap:Body>
</soap:Envelope>

View File

@ -0,0 +1,5 @@
<env:Body>
<v01:addRRLBPoolResponse xmlns:web="http://webservice.api.ultra.neustar.com/">
<RRPoolID>060339AA04175655</RRPoolID>
</v01:addRRLBPoolResponse>
</env:Body>

View File

@ -3,12 +3,6 @@
<ns1:getLoadBalancingPoolsByZoneResponse
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.app.jclouds.org."
PoolId="000000000000001" PoolType="TC" PoolStatus="0"
PoolDName="us-west-1c.app.jclouds.org." FailOver="Enabled"
Probing="Enabled" MaxActiveServers="0" />
</ns2:LBPoolData>
<ns2:LBPoolData zoneid="0000000000000001">
<ns2:PoolData PoolName="app-uswest1.jclouds.org."
PoolId="000000000000002" PoolType="RD" PoolDName="app-uswest1.jclouds.org."