mirror of https://github.com/apache/jclouds.git
Merge pull request #1547 from jclouds/ultra-geo-write-1.6.x
added code and tests for geo-based write ops in ultradns (1.6.x)
This commit is contained in:
commit
0848e10e62
|
@ -36,4 +36,15 @@ public interface UltraDNSWSExceptions {
|
|||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error 7021: Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )
|
||||
*/
|
||||
public static class DirectionalGroupOverlapException extends IllegalStateException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DirectionalGroupOverlapException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
/**
|
||||
* 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.binders;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalGroup;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class DirectionalRecordAndGeoGroupToXML implements MapBinder {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
DirectionalPoolRecord record = DirectionalPoolRecord.class.cast(postParams.get("record"));
|
||||
DirectionalGroup group = DirectionalGroup.class.cast(postParams.get("group"));
|
||||
String xml = toXML(postParams.get("poolId"), record, group, postParams.get("dirPoolRecordId"),
|
||||
postParams.get("groupId"));
|
||||
return (R) request.toBuilder().payload(xml).build();
|
||||
}
|
||||
|
||||
private static final String ADD_TEMPLATE = "<v01:addDirectionalPoolRecord><transactionID />%s%s%s</AddDirectionalRecordData></v01:addDirectionalPoolRecord>";
|
||||
private static final String UPDATE_TEMPLATE = "<v01:updateDirectionalPoolRecord><transactionID /><UpdateDirectionalRecordData directionalPoolRecordId=\"%s\">%s%s</UpdateDirectionalRecordData></v01:updateDirectionalPoolRecord>";
|
||||
private static final String NEWGROUP_TEMPLATE = "<GeolocationGroupData><GroupData groupingType=\"DEFINE_NEW_GROUP\" />%s</GeolocationGroupData>";
|
||||
private static final String EXISTINGGROUP_TEMPLATE = "<GeolocationGroupData><GroupData groupingType=\"ASSIGN_EXISTING_GROUP\" assignExistingGroupId=\"%s\" />%s</GeolocationGroupData>";
|
||||
|
||||
@VisibleForTesting
|
||||
static String toXML(Object poolId, DirectionalPoolRecord record, DirectionalGroup group, Object recordId,
|
||||
Object groupId) {
|
||||
if (poolId == null) {
|
||||
if (group != null)
|
||||
return format(UPDATE_TEMPLATE, recordId, updateRecord(record), geo(group));
|
||||
return format(UPDATE_TEMPLATE, recordId, updateRecord(record), "");
|
||||
}
|
||||
if (group == null && groupId == null) {
|
||||
return format(
|
||||
ADD_TEMPLATE,
|
||||
format("<AddDirectionalRecordData directionalPoolId=\"%s\" createAllNonConfiguredGrp=\"true\">", poolId),
|
||||
createRecord(record), "");
|
||||
}
|
||||
String addRecordToPool = format("<AddDirectionalRecordData directionalPoolId=\"%s\">", poolId);
|
||||
if (groupId != null) {
|
||||
return format(ADD_TEMPLATE, addRecordToPool, createRecord(record), format(EXISTINGGROUP_TEMPLATE, groupId, ""));
|
||||
}
|
||||
return format(ADD_TEMPLATE, addRecordToPool, createRecord(record), format(NEWGROUP_TEMPLATE, geo(group)));
|
||||
}
|
||||
|
||||
private static String createRecord(DirectionalPoolRecord record) {
|
||||
StringBuilder recordConfig = new StringBuilder();
|
||||
recordConfig.append("<DirectionalRecordConfiguration recordType=\"").append(record.getType()).append('"');
|
||||
recordConfig.append(" TTL=\"").append(record.getTTL()).append('"');
|
||||
recordConfig.append(" noResponseRecord=\"").append(record.isNoResponseRecord()).append("\" >");
|
||||
recordConfig.append(values(record));
|
||||
recordConfig.append("</DirectionalRecordConfiguration>");
|
||||
return recordConfig.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* don't pass type or is no response when updating
|
||||
*/
|
||||
private static String updateRecord(DirectionalPoolRecord record) {
|
||||
return format("<DirectionalRecordConfiguration TTL=\"%s\" >%s</DirectionalRecordConfiguration>", record.getTTL(),
|
||||
values(record));
|
||||
}
|
||||
|
||||
private static String values(DirectionalPoolRecord record) {
|
||||
StringBuilder values = new StringBuilder("<InfoValues");
|
||||
for (int i = 0; i < record.getRData().size(); i++) {
|
||||
values.append(' ').append("Info").append(i + 1).append("Value=").append('"').append(record.getRData().get(i))
|
||||
.append('"');
|
||||
}
|
||||
values.append(" />");
|
||||
return values.toString();
|
||||
}
|
||||
|
||||
private static String geo(DirectionalGroup group) {
|
||||
StringBuilder groupData = new StringBuilder();
|
||||
groupData.append("<GeolocationGroupDetails groupName=\"").append(group.getName()).append('"');
|
||||
if (group.getDescription().isPresent())
|
||||
groupData.append(" description=\"").append(group.getDescription().get()).append('"');
|
||||
groupData.append(" >");
|
||||
for (Entry<String, Collection<String>> region : group.asMap().entrySet()) {
|
||||
groupData.append("<GeolocationGroupDefinitionData regionName=\"").append(region.getKey()).append('"');
|
||||
groupData.append(" territoryNames=\"").append(Joiner.on(';').join(region.getValue())).append("\" />");
|
||||
}
|
||||
groupData.append("</GeolocationGroupDetails>");
|
||||
return groupData.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
throw new UnsupportedOperationException("use map form");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* 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.binders;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.rest.MapBinder;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalGroup;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class UpdateDirectionalDNSGroupToXML implements MapBinder {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
|
||||
DirectionalGroup group = DirectionalGroup.class.cast(postParams.get("group"));
|
||||
String xml = toXML(postParams.get("dirPoolRecordId"), group);
|
||||
return (R) request.toBuilder().payload(xml).build();
|
||||
}
|
||||
|
||||
private static final String template = "<v01:updateDirectionalDNSGroup><transactionID /><dirPoolRecordId>%s</dirPoolRecordId>%s</v01:updateDirectionalDNSGroup>";
|
||||
|
||||
@VisibleForTesting
|
||||
static String toXML(Object dirPoolRecordId, DirectionalGroup group) {
|
||||
return format(template, dirPoolRecordId, geo(group));
|
||||
}
|
||||
|
||||
private static String geo(DirectionalGroup group) {
|
||||
StringBuilder groupData = new StringBuilder();
|
||||
groupData.append("<DirectionalDNSGroupDetail GroupName=\"").append(group.getName()).append('"');
|
||||
if (group.getDescription().isPresent())
|
||||
groupData.append(" Description=\"").append(group.getDescription().get()).append('"');
|
||||
groupData.append(" ><DirectionalDNSRegion>");
|
||||
for (Entry<String, Collection<String>> region : group.asMap().entrySet()) {
|
||||
groupData.append("<RegionForNewGroups RegionName=\"").append(region.getKey()).append('"');
|
||||
groupData.append(" TerritoryName=\"").append(Joiner.on(';').join(region.getValue())).append("\" />");
|
||||
}
|
||||
groupData.append("</DirectionalDNSRegion></DirectionalDNSGroupDetail>");
|
||||
return groupData.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||
throw new UnsupportedOperationException("use map form");
|
||||
}
|
||||
}
|
|
@ -112,18 +112,6 @@ public final class DirectionalPool {
|
|||
|
||||
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) {
|
||||
|
|
|
@ -68,6 +68,30 @@ public final class RoundRobinPool {
|
|||
return dname;
|
||||
}
|
||||
|
||||
/**
|
||||
* currently supported {@link ResourceRecord#getType() types} for round robin pools.
|
||||
*
|
||||
*/
|
||||
public static enum RecordType {
|
||||
A(1),
|
||||
AAAA(28);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(code);
|
||||
}
|
||||
|
||||
private final int code;
|
||||
|
||||
private RecordType(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(zoneId, id, name, dname);
|
||||
|
|
|
@ -121,6 +121,10 @@ public final class TrafficControllerPool {
|
|||
private RecordType(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,6 +36,7 @@ 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.DirectionalPool.RecordType;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
|
||||
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
||||
import org.jclouds.ultradns.ws.xml.AccountLevelGroupsHandler;
|
||||
|
@ -103,9 +104,7 @@ public interface DirectionalGroupApi {
|
|||
* @param hostName
|
||||
* fully qualified hostname including the trailing dot.
|
||||
* @param rrType
|
||||
* type value, with special casing: for {@code A} or {@code CNAME}
|
||||
* of ipv4 hosts, this is {@code 1}; for {@code AAAA} or
|
||||
* {@code CNAME} of ipv4 hosts, this is {@code 28}
|
||||
* {@link RecordType type} value of the existing records.
|
||||
* @return empty if there are not groups for the specified host and type
|
||||
*/
|
||||
@Named("getAvailableGroups")
|
||||
|
@ -113,7 +112,7 @@ public interface DirectionalGroupApi {
|
|||
@XMLResponseParser(ItemListHandler.class)
|
||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||
@Payload("<v01:getAvailableGroups><poolName>{hostName}</poolName><poolRecordType>{rrType}</poolRecordType><accountID>{accountId}</accountID><groupType /></v01:getAvailableGroups>")
|
||||
FluentIterable<String> listGroupNamesByRecordNameAndType(
|
||||
FluentIterable<String> listGroupNamesByDNameAndType(
|
||||
@PayloadParam("hostName") String hostName, @PayloadParam("rrType") int rrType);
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,22 +18,35 @@
|
|||
*/
|
||||
package org.jclouds.ultradns.ws.features;
|
||||
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.POST;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.ParamParser;
|
||||
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.UltraDNSWSApi;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.DirectionalGroupOverlapException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.binders.DirectionalRecordAndGeoGroupToXML;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalGroup;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool;
|
||||
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.filters.SOAPWrapWithPasswordAuth;
|
||||
import org.jclouds.ultradns.ws.internal.DirectionalPoolRecordTypeToString;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalPoolListHandler;
|
||||
import org.jclouds.ultradns.ws.xml.DirectionalPoolRecordDetailListHandler;
|
||||
import org.jclouds.ultradns.ws.xml.ElementTextHandler;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
||||
|
@ -62,23 +75,175 @@ public interface DirectionalPoolApi {
|
|||
* Returns all the directional pool records in the zone with the fully
|
||||
* qualified {@link hostName} and {@link rrType}
|
||||
*
|
||||
* @param hostName
|
||||
* @param dname
|
||||
* fully qualified hostname including the trailing dot.
|
||||
* @param rrType
|
||||
* type value, with special casing: for {@code A} or {@code CNAME}
|
||||
* of ipv4 hosts, this is {@code 1}; for {@code AAAA} or
|
||||
* {@code CNAME} of ipv4 hosts, this is {@code 28}
|
||||
* {@link RecordType type} value of the existing records.
|
||||
* @return empty if there are not pools for the specified host or no records
|
||||
* exist for the type.
|
||||
* @throws ResourceNotFoundException
|
||||
* if the zone doesn't exist
|
||||
* @see RecordType#getCode()
|
||||
*/
|
||||
@Named("getDirectionalDNSRecordsForHost")
|
||||
@POST
|
||||
@XMLResponseParser(DirectionalPoolRecordDetailListHandler.class)
|
||||
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||
@Payload("<v01:getDirectionalDNSRecordsForHost><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><poolRecordType>{poolRecordType}</poolRecordType></v01:getDirectionalDNSRecordsForHost>")
|
||||
FluentIterable<DirectionalPoolRecordDetail> listRecordsByNameAndType(
|
||||
@PayloadParam("hostName") String dname, @PayloadParam("poolRecordType") int type)
|
||||
throws ResourceNotFoundException;
|
||||
FluentIterable<DirectionalPoolRecordDetail> listRecordsByDNameAndType(@PayloadParam("hostName") String dname,
|
||||
@PayloadParam("poolRecordType") int rrType) throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
* creates a directional pool for {@code A} and {@code CNAME} (ipv4) records
|
||||
*
|
||||
* @param name
|
||||
* {@link DirectionalPool#getName() description} of the Geo pool
|
||||
* @param dname
|
||||
* {@link DirectionalPool#getDName() dname} of the Geo pool {ex.
|
||||
* www.jclouds.org.}
|
||||
* @param rrType
|
||||
* {@link RecordType type} value for the records added to this
|
||||
* pool..
|
||||
* @return the {@link DirectionalPool#getId() id} of the new pool
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a pool already exists with the same attrs
|
||||
*/
|
||||
@Named("addDirectionalPool")
|
||||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.DirPoolID.class)
|
||||
@Payload("<v01:addDirectionalPool><transactionID /><AddDirectionalPoolData dirPoolType=\"GEOLOCATION\" poolRecordType=\"{poolRecordType}\" zoneName=\"{zoneName}\" hostName=\"{hostName}\" description=\"{description}\"/></v01:addDirectionalPool>")
|
||||
String createForDNameAndType(@PayloadParam("description") String name, @PayloadParam("hostName") String dname,
|
||||
@PayloadParam("poolRecordType") @ParamParser(DirectionalPoolRecordTypeToString.class) int rrType)
|
||||
throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* creates a resource record in the pool.
|
||||
*
|
||||
* @param poolId
|
||||
* pool to create the record in.
|
||||
* @param toCreate
|
||||
* the new record to create.
|
||||
* @param group
|
||||
* geo groups associated. Use the
|
||||
* {@link UltraDNSWSApi#getRegionsByIdAndName()} to obtain the
|
||||
* regionName and territoryNames. To specify all of a region’s
|
||||
* territories, use
|
||||
* {@link DirectionalGroup.Builder#mapRegion(String)}
|
||||
* @return the {@link DirectionalPoolRecordDetail#getId() id} of the new record
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a record already exists with the same attrs
|
||||
*/
|
||||
@Named("addDirectionalPoolRecord")
|
||||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.DirectionalPoolRecordID.class)
|
||||
@MapBinder(DirectionalRecordAndGeoGroupToXML.class)
|
||||
String addRecordIntoNewGroup(@PayloadParam("poolId") String poolId,
|
||||
@PayloadParam("record") DirectionalPoolRecord toCreate, @PayloadParam("group") DirectionalGroup group)
|
||||
throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* creates a resource record in the pool.
|
||||
*
|
||||
* @param poolId
|
||||
* pool to create the record in.
|
||||
* @param toCreate
|
||||
* the new record to create.
|
||||
* @param groupId
|
||||
* existing group from another record of the same dname and type.
|
||||
* For example
|
||||
* {@link DirectionalPoolRecordDetail#getGeolocationGroup()} or
|
||||
* {@link DirectionalPoolRecordDetail#getGroup()}.
|
||||
* @return the {@link DirectionalPoolRecordDetail#getId() id} of the new record
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a record already exists with the same attrs
|
||||
*/
|
||||
@Named("addDirectionalPoolRecord")
|
||||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.DirectionalPoolRecordID.class)
|
||||
@MapBinder(DirectionalRecordAndGeoGroupToXML.class)
|
||||
String addRecordIntoExistingGroup(@PayloadParam("poolId") String poolId,
|
||||
@PayloadParam("record") DirectionalPoolRecord toCreate, @PayloadParam("groupId") String groupId)
|
||||
throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* creates a resource record in the pool, creating and assigning it to the
|
||||
* special "non configured group".
|
||||
*
|
||||
* @param poolId
|
||||
* pool to create the record in.
|
||||
* @param toCreate
|
||||
* the new record to create.
|
||||
* @return the {@link DirectionalPoolRecordDetail#getId() id} of the new record
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a record already exists with the same attrs
|
||||
*/
|
||||
@Named("addDirectionalPoolRecord")
|
||||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.DirectionalPoolRecordID.class)
|
||||
@MapBinder(DirectionalRecordAndGeoGroupToXML.class)
|
||||
String addFirstRecordInNonConfiguredGroup(@PayloadParam("poolId") String poolId,
|
||||
@PayloadParam("record") DirectionalPoolRecord toCreate) throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* updates such as ttl or rdata for an existing directional record.
|
||||
*
|
||||
* @param recordId
|
||||
* id of the record to update
|
||||
* @param update
|
||||
* the updated record.
|
||||
* @throws ResourceNotFoundException
|
||||
* if the record doesn't exist
|
||||
*/
|
||||
@Named("updateDirectionalPoolRecord")
|
||||
@POST
|
||||
@MapBinder(DirectionalRecordAndGeoGroupToXML.class)
|
||||
void updateRecord(@PayloadParam("dirPoolRecordId") String recordId,
|
||||
@PayloadParam("record") DirectionalPoolRecord update) throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
* updates the geo groups of an existing directional record.
|
||||
*
|
||||
* @param recordId
|
||||
* id of the record to update
|
||||
* @param update
|
||||
* the updated record.
|
||||
* @param group
|
||||
* geo groups associated.
|
||||
* @throws ResourceNotFoundException
|
||||
* if the record doesn't exist
|
||||
* @throws DirectionalGroupOverlapException
|
||||
* if there's an overlap with another record in the pool. (ex.
|
||||
* have the same territories)
|
||||
*/
|
||||
@Named("updateDirectionalPoolRecord")
|
||||
@POST
|
||||
@MapBinder(DirectionalRecordAndGeoGroupToXML.class)
|
||||
void updateRecordAndGroup(@PayloadParam("dirPoolRecordId") String recordId,
|
||||
@PayloadParam("record") DirectionalPoolRecord update, @PayloadParam("group") DirectionalGroup group)
|
||||
throws ResourceNotFoundException, DirectionalGroupOverlapException;
|
||||
|
||||
/**
|
||||
* deletes a specific directional pool record
|
||||
*
|
||||
* @param id
|
||||
* the {@link DirectionalPoolRecordDetail#getId() id} of the
|
||||
* record.
|
||||
*/
|
||||
@Named("deleteResourceRecord")
|
||||
@POST
|
||||
@Payload("<v01:deleteDirectionalPoolRecord><transactionID /><dirPoolRecordId>{dirPoolRecordId}</dirPoolRecordId></v01:deleteDirectionalPoolRecord>")
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
void deleteRecord(@PayloadParam("dirPoolRecordId") String id);
|
||||
|
||||
/**
|
||||
* removes a pool and all its records
|
||||
*
|
||||
* @param id
|
||||
* the {@link DirectionalPool#getId() id}
|
||||
*/
|
||||
@Named("deleteDirectionalPool")
|
||||
@POST
|
||||
@Payload("<v01:deleteDirectionalPool><transactionID /><dirPoolID>{dirPoolID}</dirPoolID><retainRecordID /></v01:deleteDirectionalPool>")
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
void delete(@PayloadParam("dirPoolID") String id);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ 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.ParamParser;
|
||||
import org.jclouds.rest.annotations.Payload;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
|
@ -34,6 +35,7 @@ import org.jclouds.ultradns.ws.domain.ResourceRecord;
|
|||
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.internal.RoundRobinPoolRecordTypeToString;
|
||||
import org.jclouds.ultradns.ws.xml.ElementTextHandler;
|
||||
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
|
||||
import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler;
|
||||
|
@ -75,13 +77,15 @@ public interface RoundRobinPoolApi {
|
|||
throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
* creates a round robin pool for {@code A} (ipv4) records
|
||||
* creates a round robin pool.
|
||||
*
|
||||
* @param name
|
||||
* {@link RoundRobinPool#getName() name} of the RR pool
|
||||
* @param dname
|
||||
* {@link RoundRobinPool#getDName() dname} of the RR pool {ex.
|
||||
* www.jclouds.org.}
|
||||
* @param rrType
|
||||
* the {@link RoundRobinPool.RecordType record type} supported.
|
||||
* @return the {@code guid} of the new pool
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a pool already exists with the same attrs
|
||||
|
@ -89,9 +93,10 @@ public interface RoundRobinPoolApi {
|
|||
@Named("addRRLBPool")
|
||||
@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 createAPoolForDName(@PayloadParam("description") String name,
|
||||
@PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException;
|
||||
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>{poolRecordType}</poolRecordType><rrGUID /></v01:addRRLBPool>")
|
||||
String createForDNameAndType(@PayloadParam("description") String name, @PayloadParam("hostName") String dname,
|
||||
@PayloadParam("poolRecordType") @ParamParser(RoundRobinPoolRecordTypeToString.class) int rrType)
|
||||
throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* adds a new {@code A} record to the pool
|
||||
|
@ -133,9 +138,8 @@ public interface RoundRobinPoolApi {
|
|||
@Named("updateRecordOfRRPool")
|
||||
@POST
|
||||
@Payload("<v01:updateRecordOfRRPool><transactionID /><resourceRecord rrGuid=\"{guid}\" lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" TTL=\"{ttl}\"/></v01:updateRecordOfRRPool>")
|
||||
void updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
|
||||
@PayloadParam("guid") String guid, @PayloadParam("address") String ipv4Address,
|
||||
@PayloadParam("ttl") int ttl) throws ResourceNotFoundException;
|
||||
void updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, @PayloadParam("guid") String guid,
|
||||
@PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl) throws ResourceNotFoundException;
|
||||
|
||||
/**
|
||||
* deletes a specific pooled resource record
|
||||
|
@ -150,25 +154,6 @@ public interface RoundRobinPoolApi {
|
|||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
void deleteRecord(@PayloadParam("guid") String guid);
|
||||
|
||||
/**
|
||||
* creates a round robin pool for {@code AAAA} (ipv6) records
|
||||
*
|
||||
* @param name
|
||||
* {@link RoundRobinPool#getName() name} of the RR pool
|
||||
* @param dname
|
||||
* {@link RoundRobinPool#getDName() dname} {ex.
|
||||
* www.jclouds.org.}
|
||||
* @return the {@code guid} of the new record
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a pool already exists with the same attrs
|
||||
*/
|
||||
@Named("addRRLBPool")
|
||||
@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 createAAAAPoolForDName(@PayloadParam("description") String name,
|
||||
@PayloadParam("hostName") String dname) throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* adds a new {@code AAAA} record to the pool
|
||||
*
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.jclouds.javax.annotation.Nullable;
|
|||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.ParamParser;
|
||||
import org.jclouds.rest.annotations.Payload;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
|
@ -36,10 +37,10 @@ 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.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.internal.TrafficControllerPoolRecordTypeToString;
|
||||
import org.jclouds.ultradns.ws.xml.AttributeHandler;
|
||||
import org.jclouds.ultradns.ws.xml.ElementTextHandler;
|
||||
import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler;
|
||||
|
@ -65,8 +66,9 @@ public interface TrafficControllerPoolApi {
|
|||
* @param dname
|
||||
* {@link TrafficControllerPool#getDName() dname} of the TC pool
|
||||
* {ex. www.jclouds.org.}
|
||||
* @param type
|
||||
* the record types supported.
|
||||
* @param rrType
|
||||
* the {@link TrafficControllerPool.RecordType record type}
|
||||
* supported.
|
||||
* @return the {@code guid} of the new record
|
||||
* @throws ResourceAlreadyExistsException
|
||||
* if a pool already exists with the same attrs
|
||||
|
@ -75,8 +77,9 @@ public interface TrafficControllerPoolApi {
|
|||
@POST
|
||||
@XMLResponseParser(ElementTextHandler.TCPoolID.class)
|
||||
@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;
|
||||
String createForDNameAndType(@PayloadParam("description") String name, @PayloadParam("hostName") String dname,
|
||||
@PayloadParam("poolRecordType") @ParamParser(TrafficControllerPoolRecordTypeToString.class) int rrType)
|
||||
throws ResourceAlreadyExistsException;
|
||||
|
||||
/**
|
||||
* Returns all traffic controller pools in the zone.
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.jclouds.http.HttpResponseException;
|
|||
import org.jclouds.http.functions.ParseSax.Factory;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSError;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.DirectionalGroupOverlapException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSResponseException;
|
||||
import org.jclouds.ultradns.ws.xml.UltraWSExceptionHandler;
|
||||
|
@ -97,11 +98,15 @@ public class UltraDNSWSErrorHandler implements HttpErrorHandler {
|
|||
/**
|
||||
* No Pool or Multiple pools of same type exists for the PoolName
|
||||
*/
|
||||
static final int DIRECTIONAL_POOL_NOT_FOUND = 2142;
|
||||
static final int DIRECTIONALPOOL_NOT_FOUND = 2142;
|
||||
/**
|
||||
* Account not found in the system.
|
||||
*/
|
||||
static final int ACCOUNT_NOT_FOUND = 2401;
|
||||
/**
|
||||
* Directional Pool Record does not exist in the system
|
||||
*/
|
||||
static final int DIRECTIONALPOOL_RECORD_NOT_FOUND = 2705;
|
||||
/**
|
||||
* Pool does not exist in the system.
|
||||
*/
|
||||
|
@ -118,6 +123,14 @@ public class UltraDNSWSErrorHandler implements HttpErrorHandler {
|
|||
* Group does not exist.
|
||||
*/
|
||||
static final int GROUP_NOT_FOUND = 4003;
|
||||
/**
|
||||
* Resource Record already exists.
|
||||
*/
|
||||
static final int POOL_RECORD_ALREADY_EXISTS = 4009;
|
||||
/**
|
||||
* Geolocation/Source IP overlap(s) found
|
||||
*/
|
||||
static final int DIRECTIONALPOOL_OVERLAP = 7021;
|
||||
}
|
||||
|
||||
private Exception refineException(UltraDNSWSResponseException exception) {
|
||||
|
@ -132,14 +145,18 @@ public class UltraDNSWSErrorHandler implements HttpErrorHandler {
|
|||
case ErrorCodes.RESOURCE_RECORD_NOT_FOUND:
|
||||
case ErrorCodes.ACCOUNT_NOT_FOUND:
|
||||
case ErrorCodes.POOL_NOT_FOUND:
|
||||
case ErrorCodes.DIRECTIONAL_POOL_NOT_FOUND:
|
||||
case ErrorCodes.DIRECTIONALPOOL_NOT_FOUND:
|
||||
case ErrorCodes.DIRECTIONALPOOL_RECORD_NOT_FOUND:
|
||||
case ErrorCodes.POOL_RECORD_NOT_FOUND:
|
||||
case ErrorCodes.GROUP_NOT_FOUND:
|
||||
return new ResourceNotFoundException(message, exception);
|
||||
case ErrorCodes.ZONE_ALREADY_EXISTS:
|
||||
case ErrorCodes.RESOURCE_RECORD_ALREADY_EXISTS:
|
||||
case ErrorCodes.POOL_ALREADY_EXISTS:
|
||||
case ErrorCodes.POOL_RECORD_ALREADY_EXISTS:
|
||||
return new ResourceAlreadyExistsException(message, exception);
|
||||
case ErrorCodes.DIRECTIONALPOOL_OVERLAP:
|
||||
return new DirectionalGroupOverlapException(message, exception);
|
||||
}
|
||||
return exception;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* 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.internal;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* pools use the address type also for cnames.
|
||||
*/
|
||||
public class DirectionalPoolRecordTypeToString implements Function<Object, String> {
|
||||
@Inject
|
||||
private DirectionalPoolRecordTypeToString() {
|
||||
}
|
||||
|
||||
public String apply(Object in) {
|
||||
int rrType = Integer.class.cast(in);
|
||||
for (RecordType type : EnumSet.allOf(RecordType.class)) {
|
||||
if (type.getCode() == rrType) {
|
||||
switch (type) {
|
||||
case IPV4:
|
||||
return "A";
|
||||
case IPV6:
|
||||
return "AAAA";
|
||||
default:
|
||||
return type.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("unsupported rrType " + rrType + " please see " + RecordType.class.getName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* 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.internal;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.ultradns.ws.domain.RoundRobinPool.RecordType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
public class RoundRobinPoolRecordTypeToString implements Function<Object, String> {
|
||||
@Inject
|
||||
private RoundRobinPoolRecordTypeToString() {
|
||||
}
|
||||
|
||||
public String apply(Object in) {
|
||||
int rrType = Integer.class.cast(in);
|
||||
for (RecordType type : EnumSet.allOf(RecordType.class)) {
|
||||
if (type.getCode() == rrType) {
|
||||
return Integer.toString(rrType);
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("unsupported rrType " + rrType + " please see " + RecordType.class.getName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* 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.internal;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPool.RecordType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* pools use the address type also for cnames.
|
||||
*/
|
||||
public class TrafficControllerPoolRecordTypeToString implements Function<Object, String> {
|
||||
@Inject
|
||||
private TrafficControllerPoolRecordTypeToString() {
|
||||
}
|
||||
|
||||
public String apply(Object in) {
|
||||
int rrType = Integer.class.cast(in);
|
||||
for (RecordType type : EnumSet.allOf(RecordType.class)) {
|
||||
if (type.getCode() == rrType) {
|
||||
return Integer.toString(rrType);
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("unsupported rrType " + rrType + " please see " + RecordType.class.getName());
|
||||
}
|
||||
}
|
|
@ -54,6 +54,18 @@ public abstract class ElementTextHandler extends ParseSax.HandlerForGeneratedReq
|
|||
}
|
||||
}
|
||||
|
||||
public static class DirPoolID extends ElementTextHandler {
|
||||
public DirPoolID() {
|
||||
super("DirPoolID");
|
||||
}
|
||||
}
|
||||
|
||||
public static class DirectionalPoolRecordID extends ElementTextHandler {
|
||||
public DirectionalPoolRecordID() {
|
||||
super("DirectionalPoolRecordID");
|
||||
}
|
||||
}
|
||||
|
||||
private final String textElement;
|
||||
|
||||
private StringBuilder currentText = new StringBuilder();
|
||||
|
|
|
@ -51,7 +51,7 @@ public class DirectionalGroupApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
|||
public void testListGroupNamesByRecordNameAndTypeWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(listGroupNamesByRecordNameAndType, listGroupNamesByRecordNameAndTypeResponse);
|
||||
|
||||
assertEquals(success.getDirectionalGroupApiForAccount("accountid").listGroupNamesByRecordNameAndType("www.jclouds.org.", 1).toString(),
|
||||
assertEquals(success.getDirectionalGroupApiForAccount("accountid").listGroupNamesByDNameAndType("www.jclouds.org.", 1).toString(),
|
||||
new GetAvailableGroupsResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,8 @@ import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates;
|
|||
import org.jclouds.ultradns.ws.domain.DirectionalPool;
|
||||
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;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
@ -46,15 +44,6 @@ import com.google.common.collect.Sets;
|
|||
@Test(groups = "live", singleThreaded = true, testName = "DirectionalGroupApiLiveTest")
|
||||
public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
||||
|
||||
private IdAndName account;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
account = api.getCurrentAccount();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListAccountLevelGroups() {
|
||||
for (AccountLevelGroup group : api().listAccountLevelGroups()) {
|
||||
|
@ -94,7 +83,7 @@ public class DirectionalGroupApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
for (Zone zone : api.getZoneApi().listByAccount(account.getId())) {
|
||||
for (DirectionalPool pool : api.getDirectionalPoolApiForZone(zone.getName()).list()) {
|
||||
for (RecordType type : EnumSet.allOf(RecordType.class)) {
|
||||
for (String groupName : api().listGroupNamesByRecordNameAndType(pool.getDName(), type.getCode())) {
|
||||
for (String groupName : api().listGroupNamesByDNameAndType(pool.getDName(), type.getCode())) {
|
||||
allGroups.add(DirectionalGroupCoordinates.builder()
|
||||
.zoneName(zone.getName())
|
||||
.recordName(pool.getDName())
|
||||
|
|
|
@ -19,22 +19,169 @@
|
|||
package org.jclouds.ultradns.ws.features;
|
||||
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.DirectionalPool.RecordType.IPV4;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSApi;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalGroup;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
|
||||
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiExpectTest;
|
||||
import org.jclouds.ultradns.ws.parse.GetDirectionalDNSRecordsForHostResponseTest;
|
||||
import org.jclouds.ultradns.ws.parse.GetDirectionalPoolsByZoneResponseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "DirectionalPoolApiExpectTest")
|
||||
public class DirectionalPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
||||
HttpRequest create = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/create_directionalpool.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse createResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
|
||||
.payload(payloadFromResourceWithContentType("/directionalpool_created.xml", "application/xml")).build();
|
||||
|
||||
public void testCreateWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(create, createResponse);
|
||||
assertEquals(
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").createForDNameAndType("foo",
|
||||
"www.jclouds.org.", IPV4.getCode()), "06063DC355055E68");
|
||||
}
|
||||
|
||||
HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
.payload(payloadFromResourceWithContentType("/directionalpool_already_exists.xml", "application/xml"))
|
||||
.build();
|
||||
|
||||
@Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Pool already created for this host name : www.jclouds.org.")
|
||||
public void testCreateWhenResponseError2912() {
|
||||
UltraDNSWSApi already = requestSendsResponse(create, alreadyCreated);
|
||||
already.getDirectionalPoolApiForZone("jclouds.org.").createForDNameAndType("foo", "www.jclouds.org.",
|
||||
IPV4.getCode());
|
||||
}
|
||||
|
||||
HttpRequest addFirstRecordInNonConfiguredGroup = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/create_directionalrecord.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse recordCreatedResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
|
||||
.payload(payloadFromResourceWithContentType("/directionalrecord_created.xml", "application/xml")).build();
|
||||
|
||||
DirectionalPoolRecord record = DirectionalPoolRecord.drBuilder()
|
||||
.type("A")
|
||||
.ttl(300)
|
||||
.rdata("1.1.0.1").build();
|
||||
|
||||
public void testAddFirstRecordInNonConfiguredGroupWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(addFirstRecordInNonConfiguredGroup, recordCreatedResponse);
|
||||
assertEquals(
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").addFirstRecordInNonConfiguredGroup("06063DC355055E68",
|
||||
record), "06063DC355058294");
|
||||
}
|
||||
|
||||
HttpResponse recordAlreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
.payload(payloadFromResourceWithContentType("/directionalrecord_already_exists.xml", "application/xml"))
|
||||
.build();
|
||||
|
||||
@Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Resource Record already exists.")
|
||||
public void testAddFirstRecordInNonConfiguredGroupWhenResponseError1802() {
|
||||
UltraDNSWSApi already = requestSendsResponse(addFirstRecordInNonConfiguredGroup, recordAlreadyCreated);
|
||||
already.getDirectionalPoolApiForZone("jclouds.org.").addFirstRecordInNonConfiguredGroup("06063DC355055E68",
|
||||
record);
|
||||
}
|
||||
|
||||
HttpRequest addRecordIntoNewGroup = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/create_directionalrecord_newgroup.xml", "application/xml"))
|
||||
.build();
|
||||
|
||||
DirectionalGroup group = DirectionalGroup.builder()
|
||||
.name("Mexas")
|
||||
.description("Clients we classify as being in US")
|
||||
.mapRegionToTerritories("United States (US)",
|
||||
ImmutableSet.of("Maryland", "Texas"))
|
||||
.build();
|
||||
|
||||
public void testAddRecordIntoNewGroupWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(addRecordIntoNewGroup, recordCreatedResponse);
|
||||
assertEquals(
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").addRecordIntoNewGroup("06063DC355055E68", record,
|
||||
group), "06063DC355058294");
|
||||
}
|
||||
|
||||
HttpRequest addRecordIntoExistingGroup = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/create_directionalrecord_existinggroup.xml", "application/xml"))
|
||||
.build();
|
||||
|
||||
public void testAddRecordIntoExistingGroupWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(addRecordIntoExistingGroup, recordCreatedResponse);
|
||||
assertEquals(
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").addRecordIntoExistingGroup("06063DC355055E68",
|
||||
record, "AAABBBCCCDDDEEE"), "06063DC355058294");
|
||||
}
|
||||
|
||||
HttpRequest updateRecord = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/update_directionalrecord.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse updateRecordResponse = HttpResponse.builder().statusCode(OK.getStatusCode())
|
||||
.payload(payloadFromResourceWithContentType("/directionalrecord_updated.xml", "application/xml")).build();
|
||||
|
||||
public void testUpdateRecordWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(updateRecord, updateRecordResponse);
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").updateRecord("04053D8E57C7931F", record);
|
||||
}
|
||||
|
||||
HttpResponse recordDoesntExist = HttpResponse.builder().message("Server Error").statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
.payload(payloadFromResource("/directionalrecord_doesnt_exist.xml")).build();
|
||||
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Directional Pool Record does not exist in the system")
|
||||
public void testUpdateRecordWhenResponseNotFound() {
|
||||
UltraDNSWSApi notFound = requestSendsResponse(updateRecord, recordDoesntExist);
|
||||
notFound.getDirectionalPoolApiForZone("jclouds.org.").updateRecord("04053D8E57C7931F", record);
|
||||
}
|
||||
|
||||
HttpRequest updateRecordAndGroup = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/update_directionalrecord_group.xml", "application/xml")).build();
|
||||
|
||||
public void testUpdateRecordAndGroupWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(updateRecordAndGroup, updateRecordResponse);
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").updateRecordAndGroup("04053D8E57C7931F", record, group);
|
||||
}
|
||||
|
||||
HttpRequest deleteRecord = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/delete_directionalrecord.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse deleteRecordResponse = HttpResponse.builder().statusCode(404)
|
||||
.payload(payloadFromResourceWithContentType("/directionalrecord_deleted.xml", "application/xml")).build();
|
||||
|
||||
public void testDeleteRecordWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(deleteRecord, deleteRecordResponse);
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").deleteRecord("04053D8E57C7931F");
|
||||
}
|
||||
|
||||
public void testDeleteRecordWhenResponseNotFound() {
|
||||
UltraDNSWSApi notFound = requestSendsResponse(deleteRecord, recordDoesntExist);
|
||||
notFound.getDirectionalPoolApiForZone("jclouds.org.").deleteRecord("04053D8E57C7931F");
|
||||
}
|
||||
|
||||
HttpRequest list = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
|
@ -64,8 +211,7 @@ public class DirectionalPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
|||
public void testListRecordsWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(listRecords, listRecordsResponse);
|
||||
|
||||
assertEquals(
|
||||
success.getDirectionalPoolApiForZone("jclouds.org.").listRecordsByNameAndType("www.jclouds.org.", 1).toString(),
|
||||
new GetDirectionalDNSRecordsForHostResponseTest().expected().toString());
|
||||
assertEquals(success.getDirectionalPoolApiForZone("jclouds.org.").listRecordsByDNameAndType("www.jclouds.org.", 1)
|
||||
.toString(), new GetDirectionalDNSRecordsForHostResponseTest().expected().toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,44 +18,47 @@
|
|||
*/
|
||||
package org.jclouds.ultradns.ws.features;
|
||||
|
||||
import static com.google.common.base.Predicates.equalTo;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static com.google.common.collect.Iterables.isEmpty;
|
||||
import static com.google.common.collect.Sets.newLinkedHashSet;
|
||||
import static java.util.logging.Logger.getAnonymousLogger;
|
||||
import static org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType.IPV4;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.DirectionalGroupOverlapException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalGroup;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType;
|
||||
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.jclouds.ultradns.ws.domain.IdAndName;
|
||||
import org.jclouds.ultradns.ws.domain.Zone;
|
||||
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.jclouds.ultradns.ws.internal.BaseDirectionalApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", singleThreaded = true, testName = "DirectionalPoolApiLiveTest")
|
||||
public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
||||
|
||||
private IdAndName account;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
account = api.getCurrentAccount();
|
||||
}
|
||||
public class DirectionalPoolApiLiveTest extends BaseDirectionalApiLiveTest {
|
||||
|
||||
@Test
|
||||
public void testListDirectionalPools() {
|
||||
|
@ -75,7 +78,7 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
assertNotNull(pool.getTieBreak(), "TieBreak cannot be null " + pool);
|
||||
}
|
||||
|
||||
Set<IdAndName> allDirectionalGroups = Sets.newLinkedHashSet();
|
||||
Set<IdAndName> allDirectionalGroups = newLinkedHashSet();
|
||||
|
||||
@Test
|
||||
public void testListDirectionalRecords() {
|
||||
|
@ -83,11 +86,11 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
for (DirectionalPool pool : api(zone.getName()).list()) {
|
||||
for (RecordType type : EnumSet.allOf(RecordType.class)) {
|
||||
for (DirectionalPoolRecordDetail rr : api(zone.getName())
|
||||
.listRecordsByNameAndType(pool.getDName(), type.getCode())) {
|
||||
.listRecordsByDNameAndType(pool.getDName(), type.getCode())) {
|
||||
checkDirectionalRecordDetail(rr);
|
||||
Iterable<IdAndName> groups = Optional.presentInstances(ImmutableSet.of(rr.getGroup(),
|
||||
rr.getGeolocationGroup(), rr.getGeolocationGroup()));
|
||||
assertFalse(Iterables.isEmpty(groups), "No groups " + rr);
|
||||
assertFalse(isEmpty(groups), "No groups " + rr);
|
||||
for (IdAndName group : groups) {
|
||||
allDirectionalGroups.add(group);
|
||||
assertNotNull(group.getId(), "Id cannot be null " + group);
|
||||
|
@ -122,12 +125,13 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
assertNotNull(rr.getRData(), "InfoValues cannot be null " + rr);
|
||||
}
|
||||
|
||||
static void checkDirectionalRecordDetail(DirectionalPoolRecordDetail rr) {
|
||||
static DirectionalPoolRecordDetail 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);
|
||||
assertNotNull(rr.getZoneName(), "ZoneName cannot be null " + rr);
|
||||
checkDirectionalRecord(rr.getRecord());
|
||||
return rr;
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Parent Zone does not exist in the system.")
|
||||
|
@ -135,7 +139,202 @@ public class DirectionalPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
api("AAAAAAAAAAAAAAAA").list();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteWhenNotFound() {
|
||||
api(zoneName).delete("06063D9C54C5AE09");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteRecordWhenNotFound() {
|
||||
api(zoneName).deleteRecord("06063D9C54C5AE09");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Directional Pool Record does not exist in the system")
|
||||
public void testUpdateRecordWhenNotFound() {
|
||||
api(zoneName).updateRecord("06063D9C54C5AE09", cnameRecordCanary);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateCNAMEPool() {
|
||||
cnamePoolId = api(zoneName).createForDNameAndType("Geo pool", dname, IPV4.getCode());
|
||||
getAnonymousLogger().info("created Geo pool: " + cnamePoolId);
|
||||
Optional<DirectionalPool> ipv4Pool = getPoolById(cnamePoolId);
|
||||
assertTrue(ipv4Pool.isPresent());
|
||||
assertEquals(ipv4Pool.get().getZoneId(), zoneId);
|
||||
assertEquals(ipv4Pool.get().getName().get(), "Geo pool");
|
||||
assertEquals(ipv4Pool.get().getDName(), dname);
|
||||
assertEquals(ipv4Pool.get().getType(), Type.GEOLOCATION);
|
||||
assertEquals(ipv4Pool.get().getTieBreak(), TieBreak.GEOLOCATION);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreateCNAMEPool", expectedExceptions = ResourceAlreadyExistsException.class)
|
||||
public void testDuplicateCreateCNAMEPool() {
|
||||
api(zoneName).createForDNameAndType("Geo pool", dname, IPV4.getCode());
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testDuplicateCreateCNAMEPool")
|
||||
public void addCNAMERecordsToPool() {
|
||||
cnameEU = api(zoneName).addRecordIntoNewGroup(cnamePoolId, cnameRecordEU, eu);
|
||||
getAnonymousLogger().info("created CNAME record in ipv4 pool: " + cnameEU);
|
||||
checkRecordConsistent(dname, cnameEU, cnameRecordEU, eu);
|
||||
|
||||
cnameUS = api(zoneName).addRecordIntoNewGroup(cnamePoolId, cnameRecordUS, us);
|
||||
getAnonymousLogger().info("created CNAME record in ipv4 pool: " + cnameUS);
|
||||
checkRecordConsistent(dname, cnameUS, cnameRecordUS, us);
|
||||
|
||||
cnameCanary = api(zoneName).addRecordIntoNewGroup(cnamePoolId, cnameRecordCanary, nebraska);
|
||||
getAnonymousLogger().info("created CNAME record in ipv4 pool: " + cnameCanary);
|
||||
checkRecordConsistent(dname, cnameCanary, cnameRecordCanary, nebraska);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "addCNAMERecordsToPool", expectedExceptions = ResourceAlreadyExistsException.class)
|
||||
public void testDuplicateAddCNAMERecordsToPool() {
|
||||
api(zoneName).addRecordIntoNewGroup(cnamePoolId, cnameRecordEU, eu);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testDuplicateAddCNAMERecordsToPool")
|
||||
public void testUpdateRecordTTL() {
|
||||
cnameRecordCanary = cnameRecordCanary.toBuilder().ttl(180).build();
|
||||
api(zoneName).updateRecord(cnameCanary, cnameRecordCanary);
|
||||
getAnonymousLogger().info("updated CNAME record TTL in ipv4 pool: " + cnameCanary);
|
||||
checkRecordConsistent(dname, cnameCanary, cnameRecordCanary, nebraska);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testUpdateRecordTTL", expectedExceptions = DirectionalGroupOverlapException.class)
|
||||
public void testUpdateGroupWithOverlappingTerritories() {
|
||||
DirectionalGroup withUtah = nebraska.toBuilder().mapRegionToTerritory(REGION_US, "Utah").build();
|
||||
checkGroupByDNameAndIdContainsTerritory(dname, cnameUS, "Utah");
|
||||
try {
|
||||
api(zoneName).updateRecordAndGroup(cnameCanary, cnameRecordCanary, withUtah);
|
||||
} finally {
|
||||
checkRecordConsistent(dname, cnameCanary, cnameRecordCanary, nebraska);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testUpdateGroupWithOverlappingTerritories")
|
||||
public void testUpdateGroupWithLessTerritories() {
|
||||
Multimap<String, String> minusUtah = ImmutableMultimap.<String, String>builder()
|
||||
.putAll("United States (US)", filter(us.get(REGION_US), not(equalTo("Utah"))))
|
||||
.build();
|
||||
|
||||
api(zoneName).updateRecordAndGroup(cnameUS, cnameRecordUS, us.toBuilder()
|
||||
.regionToTerritories(minusUtah)
|
||||
.build());
|
||||
|
||||
checkGroupByDNameAndIdDoesntContainTerritory(dname, cnameUS, "Utah");
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testUpdateGroupWithLessTerritories")
|
||||
public void testUpdateGroupWithMoreTerritories() {
|
||||
DirectionalGroup withUtah = nebraska.toBuilder().mapRegionToTerritory(REGION_US, "Utah").build();
|
||||
api(zoneName).updateRecordAndGroup(cnameCanary, cnameRecordCanary, withUtah);
|
||||
getAnonymousLogger().info("update CNAME record in ipv4 pool: " + cnameCanary);
|
||||
|
||||
checkRecordConsistent(dname, cnameCanary, cnameRecordCanary, withUtah);
|
||||
|
||||
checkGroupByDNameAndIdContainsTerritory(dname, cnameCanary, "Nebraska");
|
||||
checkGroupByDNameAndIdContainsTerritory(dname, cnameCanary, "Utah");
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testUpdateGroupWithMoreTerritories")
|
||||
public void testAddRecordIntoGeoGroup() {
|
||||
String geoGroupId = getRecordByDNameAndId(dname, cnameCanary).get().getGeolocationGroup().get().getId();
|
||||
cname2Canary = api(zoneName).addRecordIntoExistingGroup(cnamePoolId, cname2RecordCanary, geoGroupId);
|
||||
getAnonymousLogger().info("created CNAME record in ipv4 pool: " + cname2Canary);
|
||||
|
||||
DirectionalPoolRecordDetail detail =
|
||||
checkRecordConsistentInNonConfiguredGroup(dname, cname2Canary, cname2RecordCanary);
|
||||
assertEquals(detail.getGroup().get().getId(), geoGroupId);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testAddRecordIntoGeoGroup")
|
||||
public void testDeleteRecord() {
|
||||
api(zoneName).deleteRecord(cnameEU);
|
||||
assertFalse(getRecordByDNameAndId(dname, cnameEU).isPresent());
|
||||
assertTrue(getRecordByDNameAndId(dname, cnameUS).isPresent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addRecordsWithUnconfiguredGroupToPool() {
|
||||
aPoolId = api(zoneName).createForDNameAndType("Geo pool", "a-" + dname, IPV4.getCode());
|
||||
getAnonymousLogger().info("created Geo pool: " + aPoolId);
|
||||
a1Prod = api(zoneName).addFirstRecordInNonConfiguredGroup(aPoolId, a1RecordProd);
|
||||
getAnonymousLogger().info("created A record in ipv4 pool: " + a1Prod);
|
||||
|
||||
checkRecordConsistentInNonConfiguredGroup("a-" + dname, a1Prod, a1RecordProd);
|
||||
checkGroupByDNameAndIdContainsTerritory("a-" + dname, a1Prod, "Nebraska");
|
||||
|
||||
a1Canary = api(zoneName).addRecordIntoNewGroup(aPoolId, a1RecordCanary, nebraska);
|
||||
getAnonymousLogger().info("created A record in ipv4 pool: " + a1Canary);
|
||||
|
||||
checkRecordConsistent("a-" + dname, a1Canary, a1RecordCanary, nebraska);
|
||||
checkGroupByDNameAndIdContainsTerritory("a-" + dname, a1Canary, "Nebraska");
|
||||
checkGroupByDNameAndIdDoesntContainTerritory("a-" + dname, a1Prod, "Nebraska");
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "addRecordsWithUnconfiguredGroupToPool", expectedExceptions = ResourceAlreadyExistsException.class)
|
||||
public void addDuplicateFirstRecordInNonConfiguredGroup() {
|
||||
api(zoneName).addFirstRecordInNonConfiguredGroup(aPoolId, a1RecordProd);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "addRecordsWithUnconfiguredGroupToPool", expectedExceptions = ResourceAlreadyExistsException.class)
|
||||
public void addDuplicateRecordIntoNewGroup() {
|
||||
api(zoneName).addRecordIntoNewGroup(aPoolId, a1RecordCanary, nebraska);
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = { "addDuplicateFirstRecordInNonConfiguredGroup", "addRecordsWithUnconfiguredGroupToPool" })
|
||||
public void testRemovingAddsTerritoriesBackIntoNonConfiguredGroup() {
|
||||
api(zoneName).deleteRecord(a1Canary);
|
||||
assertFalse(getRecordByDNameAndId("a-" + dname, a1Canary).isPresent());
|
||||
checkGroupByDNameAndIdContainsTerritory("a-" + dname, a1Prod, "Nebraska");
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = { "testDeleteRecord", "testRemovingAddsTerritoriesBackIntoNonConfiguredGroup" })
|
||||
public void testDeletePool() {
|
||||
api(zoneName).delete(cnamePoolId);
|
||||
assertFalse(getPoolById(cnamePoolId).isPresent());
|
||||
api(zoneName).delete(aPoolId);
|
||||
assertFalse(getPoolById(aPoolId).isPresent());
|
||||
}
|
||||
|
||||
private DirectionalPoolRecordDetail checkRecordConsistent(String dname, String recordId,
|
||||
DirectionalPoolRecord record, DirectionalGroup group) {
|
||||
DirectionalPoolRecordDetail recordDetail = getRecordByDNameAndId(dname, recordId).get();
|
||||
checkDirectionalRecordDetail(recordDetail);
|
||||
IdAndName rGroup = recordDetail.getGeolocationGroup().get();
|
||||
assertEquals(rGroup.getName(), group.getName());
|
||||
// TODO: look up each key with all and do a comparison
|
||||
if (!group.containsValue("all"))
|
||||
assertEquals(groupApi().get(rGroup.getId()), group);
|
||||
assertFalse(recordDetail.getGroup().isPresent());
|
||||
assertFalse(recordDetail.getSourceIpGroup().isPresent());
|
||||
assertEquals(recordDetail.getName(), dname);
|
||||
assertEquals(recordDetail.getZoneName(), zoneName);
|
||||
assertEquals(recordDetail.getRecord(), record);
|
||||
return recordDetail;
|
||||
}
|
||||
|
||||
private DirectionalPoolRecordDetail checkRecordConsistentInNonConfiguredGroup(String dname, String recordId,
|
||||
DirectionalPoolRecord record) {
|
||||
DirectionalPoolRecordDetail recordDetail = getRecordByDNameAndId(dname, recordId).get();
|
||||
checkDirectionalRecordDetail(recordDetail);
|
||||
IdAndName rGroup = recordDetail.getGroup().get();
|
||||
assertEquals(rGroup.getName(), "All Non-Configured Regions");
|
||||
DirectionalGroup allNonConfigured = groupApi().get(rGroup.getId());
|
||||
assertEquals(allNonConfigured.getName(), "All Non-Configured Regions");
|
||||
assertEquals(allNonConfigured.size(), 323);
|
||||
assertFalse(recordDetail.getGeolocationGroup().isPresent());
|
||||
assertFalse(recordDetail.getSourceIpGroup().isPresent());
|
||||
assertEquals(recordDetail.getZoneName(), zoneName);
|
||||
assertEquals(recordDetail.getRecord(), record);
|
||||
return recordDetail;
|
||||
}
|
||||
|
||||
private DirectionalPoolApi api(String zoneName) {
|
||||
return api.getDirectionalPoolApiForZone(zoneName);
|
||||
}
|
||||
|
||||
private DirectionalGroupApi groupApi() {
|
||||
return api.getDirectionalGroupApiForAccount(account.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
|
||||
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.ResourceRecordDetail;
|
||||
import org.jclouds.ultradns.ws.domain.Zone;
|
||||
|
@ -52,23 +51,11 @@ import com.google.common.collect.FluentIterable;
|
|||
@Test(groups = "live", singleThreaded = true, testName = "ResourceRecordApiLiveTest")
|
||||
public class ResourceRecordApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
||||
|
||||
private String zoneName = System.getProperty("user.name").replace('.', '-') + ".rr.ultradnstest.jclouds.org.";
|
||||
private IdAndName account;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
api.getZoneApi().delete(zoneName);
|
||||
account = api.getCurrentAccount();
|
||||
api.getZoneApi().createInAccount(zoneName, account.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@AfterClass(groups = { "integration", "live" })
|
||||
protected void tearDown() {
|
||||
api.getZoneApi().delete(zoneName);
|
||||
super.tearDown();
|
||||
createZone();
|
||||
}
|
||||
|
||||
static void checkResourceRecord(ResourceRecord rr) {
|
||||
|
|
|
@ -21,6 +21,8 @@ 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.RoundRobinPool.RecordType.A;
|
||||
import static org.jclouds.ultradns.ws.domain.RoundRobinPool.RecordType.AAAA;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -52,12 +54,16 @@ public class RoundRobinPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
|||
|
||||
public void testCreateAWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(createA, createResponse);
|
||||
assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAPoolForDName("www.jclouds.org.", "foo"), "060339AA04175655");
|
||||
assertEquals(
|
||||
success.getRoundRobinPoolApiForZone("jclouds.org.").createForDNameAndType("www.jclouds.org.", "foo",
|
||||
A.getCode()), "060339AA04175655");
|
||||
}
|
||||
|
||||
public void testCreateAAAAWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(createAAAA, createResponse);
|
||||
assertEquals(success.getRoundRobinPoolApiForZone("jclouds.org.").createAAAAPoolForDName("www.jclouds.org.", "foo"), "060339AA04175655");
|
||||
assertEquals(
|
||||
success.getRoundRobinPoolApiForZone("jclouds.org.").createForDNameAndType("www.jclouds.org.", "foo",
|
||||
AAAA.getCode()), "060339AA04175655");
|
||||
}
|
||||
|
||||
HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
|
@ -66,7 +72,8 @@ 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.").createAPoolForDName("www.jclouds.org.", "foo");
|
||||
already.getRoundRobinPoolApiForZone("jclouds.org.").createForDNameAndType("www.jclouds.org.", "foo",
|
||||
A.getCode());
|
||||
}
|
||||
|
||||
HttpRequest list = HttpRequest.builder().method(POST)
|
||||
|
|
|
@ -21,6 +21,8 @@ package org.jclouds.ultradns.ws.features;
|
|||
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.jclouds.ultradns.ws.domain.RoundRobinPool.RecordType.A;
|
||||
import static org.jclouds.ultradns.ws.domain.RoundRobinPool.RecordType.AAAA;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
@ -29,13 +31,11 @@ import static org.testng.Assert.fail;
|
|||
|
||||
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.ResourceRecordDetail;
|
||||
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;
|
||||
|
||||
|
@ -49,16 +49,11 @@ import com.google.common.collect.FluentIterable;
|
|||
@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 IdAndName account;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
api.getZoneApi().delete(zoneName);
|
||||
account = api.getCurrentAccount();
|
||||
api.getZoneApi().createInAccount(zoneName, account.getId());
|
||||
createZone();
|
||||
}
|
||||
|
||||
private void checkRRPool(RoundRobinPool pool) {
|
||||
|
@ -103,10 +98,10 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testCreateAPool() {
|
||||
aPoolId = api(zoneName).createAPoolForDName("A pool", dname);
|
||||
aPoolId = api(zoneName).createForDNameAndType("A pool", dname, A.getCode());
|
||||
getAnonymousLogger().info("created A rr pool: " + aPoolId);
|
||||
try {
|
||||
api(zoneName).createAPoolForDName("A pool", dname);
|
||||
api(zoneName).createForDNameAndType("A pool", dname, A.getCode());
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
|
@ -170,10 +165,10 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
|
||||
@Test
|
||||
public void testCreateAAAAPool() {
|
||||
aaaaPoolId = api(zoneName).createAAAAPoolForDName("AAAA pool", dname);
|
||||
aaaaPoolId = api(zoneName).createForDNameAndType("AAAA pool", dname, AAAA.getCode());
|
||||
getAnonymousLogger().info("created AAAA rr pool: " + aaaaPoolId);
|
||||
try {
|
||||
api(zoneName).createAAAAPoolForDName("AAAA pool", dname);
|
||||
api(zoneName).createForDNameAndType("AAAA pool", dname, AAAA.getCode());
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
|
@ -241,15 +236,4 @@ public class RoundRobinPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
private RoundRobinPoolApi api(String zoneName) {
|
||||
return api.getRoundRobinPoolApiForZone(zoneName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@AfterClass(groups = { "integration", "live" })
|
||||
protected void tearDown() {
|
||||
if (aPoolId != null)
|
||||
api(zoneName).delete(aPoolId);
|
||||
if (aaaaPoolId != null)
|
||||
api(zoneName).delete(aaaaPoolId);
|
||||
api.getZoneApi().delete(zoneName);
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
|
|||
public void testCreateWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(create, createResponse);
|
||||
assertEquals(
|
||||
success.getTrafficControllerPoolApiForZone("jclouds.org.").createPoolForDNameAndType("foo",
|
||||
"www.jclouds.org.", IPV4), "060339AA0417567A");
|
||||
success.getTrafficControllerPoolApiForZone("jclouds.org.").createForDNameAndType("foo",
|
||||
"www.jclouds.org.", IPV4.getCode()), "060339AA0417567A");
|
||||
}
|
||||
|
||||
HttpResponse alreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
|
@ -62,8 +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.").createPoolForDNameAndType("foo", "www.jclouds.org.",
|
||||
IPV4);
|
||||
already.getTrafficControllerPoolApiForZone("jclouds.org.").createForDNameAndType("foo", "www.jclouds.org.",
|
||||
IPV4.getCode());
|
||||
}
|
||||
|
||||
HttpRequest list = HttpRequest.builder().method(POST)
|
||||
|
@ -148,7 +148,16 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
|
|||
UltraDNSWSApi success = requestSendsResponse(createRecord, createRecordResponse);
|
||||
assertEquals(success.getTrafficControllerPoolApiForZone("jclouds.org.").addRecordToPoolWithTTL("1.2.3.4", "04053D8E57C7931F", 300), "06063DAC54F8D3D9");
|
||||
}
|
||||
|
||||
|
||||
HttpResponse recordAlreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
.payload(payloadFromResourceWithContentType("/tcrecord_already_exists.xml", "application/xml")).build();
|
||||
|
||||
@Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Resource Record of type 1 with these attributes already exists in the system.")
|
||||
public void testCreateWhenResponseError1802() {
|
||||
UltraDNSWSApi already = requestSendsResponse(createRecord, recordAlreadyCreated);
|
||||
already.getTrafficControllerPoolApiForZone("jclouds.org.").addRecordToPoolWithTTL("1.2.3.4", "04053D8E57C7931F", 300);
|
||||
}
|
||||
|
||||
HttpRequest createRecordWithWeight = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
|
@ -161,15 +170,6 @@ public class TrafficControllerPoolApiExpectTest extends BaseUltraDNSWSApiExpectT
|
|||
"04053D8E57C7931F", 300, 0), "06063DAC54F8D3D9");
|
||||
}
|
||||
|
||||
HttpResponse recordAlreadyCreated = HttpResponse.builder().statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
.payload(payloadFromResourceWithContentType("/tcrecord_already_exists.xml", "application/xml")).build();
|
||||
|
||||
@Test(expectedExceptions = ResourceAlreadyExistsException.class, expectedExceptionsMessageRegExp = "Resource Record of type 1 with these attributes already exists in the system.")
|
||||
public void testCreateWhenResponseError1802() {
|
||||
UltraDNSWSApi already = requestSendsResponse(createRecord, recordAlreadyCreated);
|
||||
already.getTrafficControllerPoolApiForZone("jclouds.org.").addRecordToPoolWithTTL("1.2.3.4", "04053D8E57C7931F", 300);
|
||||
}
|
||||
|
||||
HttpRequest getRecordSpec = HttpRequest.builder().method(POST)
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader(HOST, "ultra-api.ultradns.com:8443")
|
||||
|
|
|
@ -32,7 +32,6 @@ import static org.testng.Assert.fail;
|
|||
|
||||
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.PoolRecordSpec;
|
||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
|
||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord;
|
||||
|
@ -54,16 +53,11 @@ import com.google.common.collect.ImmutableSet;
|
|||
@Test(groups = "live", singleThreaded = true, testName = "TrafficControllerPoolApiLiveTest")
|
||||
public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
||||
|
||||
private String zoneName = System.getProperty("user.name").replace('.', '-') + ".tcpool.ultradnstest.jclouds.org.";
|
||||
private IdAndName account;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
api.getZoneApi().delete(zoneName);
|
||||
account = api.getCurrentAccount();
|
||||
api.getZoneApi().createInAccount(zoneName, account.getId());
|
||||
createZone();
|
||||
}
|
||||
|
||||
private void checkTCPool(TrafficControllerPool pool) {
|
||||
|
@ -166,17 +160,17 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
|
||||
@Test
|
||||
public void testCreatePool() {
|
||||
poolId = api(zoneName).createPoolForDNameAndType("pool", dname, IPV4);
|
||||
poolId = api(zoneName).createForDNameAndType("pool", dname, IPV4.getCode());
|
||||
getAnonymousLogger().info("created tc pool: " + poolId);
|
||||
try {
|
||||
api(zoneName).createPoolForDNameAndType("pool", dname, IPV4);
|
||||
api(zoneName).createForDNameAndType("pool", dname, IPV4.getCode());
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
}
|
||||
// ensure there's only one pool for a dname
|
||||
try {
|
||||
api(zoneName).createPoolForDNameAndType("pool1", dname, IPV4);
|
||||
api(zoneName).createForDNameAndType("pool1", dname, IPV4.getCode());
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
|
@ -285,7 +279,6 @@ public class TrafficControllerPoolApiLiveTest extends BaseUltraDNSWSApiLiveTest
|
|||
protected void tearDown() {
|
||||
if (poolId != null)
|
||||
api(zoneName).delete(poolId);
|
||||
api.getZoneApi().delete(zoneName);
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,12 +29,10 @@ import static org.testng.Assert.fail;
|
|||
|
||||
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.Zone;
|
||||
import org.jclouds.ultradns.ws.domain.Zone.Type;
|
||||
import org.jclouds.ultradns.ws.domain.ZoneProperties;
|
||||
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
@ -45,15 +43,6 @@ import com.google.common.collect.FluentIterable;
|
|||
@Test(groups = "live", testName = "ZoneApiLiveTest")
|
||||
public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
||||
|
||||
private IdAndName account;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
account = api.getCurrentAccount();
|
||||
}
|
||||
|
||||
private void checkZone(Zone zone) {
|
||||
assertNotNull(zone.getId(), "Id cannot be null for " + zone);
|
||||
assertNotNull(zone.getName(), "Name cannot be null for " + zone);
|
||||
|
@ -111,32 +100,30 @@ public class ZoneApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
|||
|
||||
@Test(expectedExceptions = ResourceNotFoundException.class, expectedExceptionsMessageRegExp = "Account not found in the system. ID: AAAAAAAAAAAAAAAA")
|
||||
public void testCreateZoneBadAccountId() {
|
||||
api().createInAccount(name, "AAAAAAAAAAAAAAAA");
|
||||
api().createInAccount(zoneName, "AAAAAAAAAAAAAAAA");
|
||||
}
|
||||
|
||||
String name = System.getProperty("user.name").replace('.', '-') + ".zone.ultradnstest.jclouds.org.";
|
||||
|
||||
@Test
|
||||
public void testCreateAndDeleteZone() {
|
||||
try {
|
||||
api().createInAccount(name, account.getId());
|
||||
ZoneProperties newZone = api().get(name);
|
||||
api().createInAccount(zoneName, account.getId());
|
||||
ZoneProperties newZone = api().get(zoneName);
|
||||
getAnonymousLogger().info("created zone: " + newZone);
|
||||
|
||||
try {
|
||||
api().createInAccount(name, account.getId());
|
||||
api().createInAccount(zoneName, account.getId());
|
||||
fail();
|
||||
} catch (ResourceAlreadyExistsException e) {
|
||||
|
||||
}
|
||||
|
||||
assertEquals(newZone.getName(), name);
|
||||
assertEquals(newZone.getName(), zoneName);
|
||||
assertEquals(newZone.getType(), Type.PRIMARY);
|
||||
assertEquals(newZone.getTypeCode(), Type.PRIMARY.getCode());
|
||||
assertNotNull(newZone.getModified(), "Modified cannot be null for " + newZone);
|
||||
assertEquals(newZone.getResourceRecordCount(), 5);
|
||||
} finally {
|
||||
api().delete(name);
|
||||
api().delete(zoneName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.jclouds.http.HttpResponse;
|
|||
import org.jclouds.http.functions.config.SaxParserModule;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.DirectionalGroupOverlapException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSResponseException;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -339,6 +340,54 @@ public class UltraDNSWSErrorHandlerTest {
|
|||
assertEquals(exception.getError().getCode(), 4003);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCode2705SetsResourceNotFoundException() 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_directionalrecord.xml")).build();
|
||||
HttpCommand command = new HttpCommand(request);
|
||||
HttpResponse response = HttpResponse.builder()
|
||||
.message(INTERNAL_SERVER_ERROR.getReasonPhrase())
|
||||
.statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
.payload(payloadFromResource("/directionalrecord_doesnt_exist.xml")).build();
|
||||
|
||||
function.handleError(command, response);
|
||||
|
||||
assertEquals(command.getException().getClass(), ResourceNotFoundException.class);
|
||||
assertEquals(command.getException().getMessage(), "Directional Pool Record does not exist in the system");
|
||||
|
||||
UltraDNSWSResponseException exception = UltraDNSWSResponseException.class.cast(command.getException().getCause());
|
||||
|
||||
assertEquals(exception.getMessage(), "Error 2705: Directional Pool Record does not exist in the system");
|
||||
assertEquals(exception.getError().getDescription().get(), "Directional Pool Record does not exist in the system");
|
||||
assertEquals(exception.getError().getCode(), 2705);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCode7021SetsDirectionalGroupOverlapException() 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_directionalrecord_newgroup.xml")).build();
|
||||
HttpCommand command = new HttpCommand(request);
|
||||
HttpResponse response = HttpResponse.builder()
|
||||
.message(INTERNAL_SERVER_ERROR.getReasonPhrase())
|
||||
.statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
|
||||
.payload(payloadFromResource("/directionalgroup_overlap.xml")).build();
|
||||
|
||||
function.handleError(command, response);
|
||||
|
||||
assertEquals(command.getException().getClass(), DirectionalGroupOverlapException.class);
|
||||
assertEquals(command.getException().getMessage(), "Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )");
|
||||
|
||||
UltraDNSWSResponseException exception = UltraDNSWSResponseException.class.cast(command.getException().getCause());
|
||||
|
||||
assertEquals(exception.getMessage(), "Error 7021: Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )");
|
||||
assertEquals(exception.getError().getDescription().get(), "Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )");
|
||||
assertEquals(exception.getError().getCode(), 7021);
|
||||
}
|
||||
|
||||
private Payload payloadFromResource(String resource) {
|
||||
try {
|
||||
return payloadFromStringWithContentType(toStringAndClose(getClass().getResourceAsStream(resource)),
|
||||
|
|
|
@ -0,0 +1,183 @@
|
|||
/**
|
||||
* 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 WATCANTIES 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.internal;
|
||||
|
||||
import static com.google.common.base.Predicates.equalTo;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.Iterables.filter;
|
||||
import static com.google.common.collect.Multimaps.filterKeys;
|
||||
import static org.jclouds.ultradns.ws.domain.DirectionalPool.RecordType.IPV4;
|
||||
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.DirectionalGroup;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPool;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecord;
|
||||
import org.jclouds.ultradns.ws.domain.DirectionalPoolRecordDetail;
|
||||
import org.jclouds.ultradns.ws.domain.IdAndName;
|
||||
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.Multimap;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live")
|
||||
public class BaseDirectionalApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
||||
|
||||
protected String dname = "www." + zoneName;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
setupGroups();
|
||||
createZone();
|
||||
}
|
||||
|
||||
protected String cnamePoolId;
|
||||
|
||||
protected String cnameEU;
|
||||
protected DirectionalGroup eu = null;
|
||||
protected DirectionalPoolRecord cnameRecordEU = DirectionalPoolRecord.drBuilder()
|
||||
.type("CNAME")
|
||||
.ttl(8600)
|
||||
.rdata("eu." + dname).build();
|
||||
|
||||
/**
|
||||
* lower ttl as plan to accept territories from canary
|
||||
*/
|
||||
protected String cnameUS;
|
||||
protected DirectionalGroup us = null;
|
||||
protected DirectionalPoolRecord cnameRecordUS = DirectionalPoolRecord.drBuilder()
|
||||
.type("CNAME")
|
||||
.ttl(300)
|
||||
.rdata("us." + dname).build();
|
||||
|
||||
/**
|
||||
* lower ttl as plan to move territories into recordUS
|
||||
*/
|
||||
/**
|
||||
* a test state.
|
||||
*/
|
||||
protected String cnameCanary;
|
||||
protected DirectionalGroup nebraska = null;
|
||||
protected DirectionalPoolRecord cnameRecordCanary = DirectionalPoolRecord.drBuilder()
|
||||
.type("CNAME")
|
||||
.ttl(300)
|
||||
.rdata("canary." + dname).build();
|
||||
protected String cname2Canary;
|
||||
protected DirectionalPoolRecord cname2RecordCanary = cnameRecordCanary.toBuilder().rdata("parrot." + dname).build();
|
||||
|
||||
protected String aPoolId;
|
||||
|
||||
/**
|
||||
* Uses all non-configured group to support all clients
|
||||
*/
|
||||
protected String a1Prod;
|
||||
protected DirectionalPoolRecord a1RecordProd = DirectionalPoolRecord.drBuilder()
|
||||
.type("A")
|
||||
.ttl(300)
|
||||
.rdata("1.1.0.1").build();
|
||||
/**
|
||||
* contains territories currently being tested.
|
||||
*/
|
||||
protected String a1Canary;
|
||||
protected DirectionalPoolRecord a1RecordCanary = DirectionalPoolRecord.drBuilder()
|
||||
.type("A")
|
||||
.ttl(300)
|
||||
.rdata("1.1.1.1").build();
|
||||
|
||||
public static final String REGION_US = "United States (US)";
|
||||
|
||||
void setupGroups() {
|
||||
// all territories in EU
|
||||
eu = DirectionalGroup.builder()
|
||||
.name("EU")
|
||||
.description("Clients we classify as being in Europe")
|
||||
.mapRegion("Europe").build();
|
||||
nebraska = DirectionalGroup.builder()
|
||||
.name("Canary")
|
||||
.description("Clients who are testing our service")
|
||||
.mapRegionToTerritory(REGION_US, "Nebraska").build();
|
||||
|
||||
// in order to pick certain territories, we need to know what they are
|
||||
Multimap<IdAndName, String> availableRegions = api.getRegionsByIdAndName();
|
||||
|
||||
// find the us Territories
|
||||
Iterable<String> usTerritories = filterKeys(availableRegions,
|
||||
IdAndName.nameEqualTo(REGION_US)).values();
|
||||
|
||||
us = DirectionalGroup.builder()
|
||||
.name("US")
|
||||
.description("Clients we classify as being in US")
|
||||
.mapRegionToTerritories(REGION_US,
|
||||
filter(usTerritories, not(equalTo("Nebraska")))).build();
|
||||
}
|
||||
|
||||
protected void checkGroupByDNameAndIdContainsTerritory(String dname, String poolRecordId, String territory) {
|
||||
DirectionalGroup regions = getGroup(dname, poolRecordId);
|
||||
assertTrue(regions.values().contains(territory), poolRecordId + " doesn't contain " + territory);
|
||||
}
|
||||
|
||||
protected void checkGroupByDNameAndIdDoesntContainTerritory(String dname, String poolRecordId, String territory) {
|
||||
DirectionalGroup regions = getGroup(dname, poolRecordId);
|
||||
assertFalse(regions.values().contains(territory), poolRecordId + " contains " + territory);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the geo group or the non-configured group.
|
||||
*/
|
||||
private DirectionalGroup getGroup(String dname, String poolRecordId) {
|
||||
DirectionalPoolRecordDetail record = getRecordByDNameAndId(dname, poolRecordId).get();
|
||||
return api.getDirectionalGroupApiForAccount(account.getId())
|
||||
.get(record.getGeolocationGroup().or(record.getGroup()).get().getId());
|
||||
}
|
||||
|
||||
protected Optional<DirectionalPool> getPoolById(final String cnamePoolId) {
|
||||
return api.getDirectionalPoolApiForZone(zoneName)
|
||||
.list()
|
||||
.firstMatch(new Predicate<DirectionalPool>() {
|
||||
public boolean apply(DirectionalPool in) {
|
||||
return in.getId().equals(cnamePoolId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected Optional<DirectionalPoolRecordDetail> getRecordByDNameAndId(String dname, String recordId) {
|
||||
return api.getDirectionalPoolApiForZone(zoneName)
|
||||
.listRecordsByDNameAndType(dname, IPV4.getCode())
|
||||
.firstMatch(recordIdEqualTo(recordId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@AfterClass(groups = { "integration", "live" })
|
||||
protected void tearDown() {
|
||||
if (cnamePoolId != null)
|
||||
api.getDirectionalPoolApiForZone(zoneName).delete(cnamePoolId);
|
||||
if (aPoolId != null)
|
||||
api.getDirectionalPoolApiForZone(zoneName).delete(aPoolId);
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
|
@ -18,17 +18,61 @@
|
|||
*/
|
||||
package org.jclouds.ultradns.ws.internal;
|
||||
|
||||
import static com.google.common.base.CaseFormat.LOWER_HYPHEN;
|
||||
import static com.google.common.base.CaseFormat.UPPER_CAMEL;
|
||||
|
||||
import org.jclouds.apis.BaseApiLiveTest;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSApi;
|
||||
import org.jclouds.ultradns.ws.domain.IdAndName;
|
||||
import org.jclouds.ultradns.ws.domain.Zone;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live")
|
||||
public class BaseUltraDNSWSApiLiveTest extends BaseApiLiveTest<UltraDNSWSApi> {
|
||||
protected String zoneName = String.format("%s-%s.ultradnstest.jclouds.org.", System.getProperty("user.name")
|
||||
.replace('.', '-'), UPPER_CAMEL.to(LOWER_HYPHEN, getClass().getSimpleName()));
|
||||
protected String zoneId;
|
||||
protected IdAndName account;
|
||||
|
||||
public BaseUltraDNSWSApiLiveTest() {
|
||||
provider = "ultradns-ws";
|
||||
}
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setup() {
|
||||
super.setup();
|
||||
account = api.getCurrentAccount();
|
||||
}
|
||||
|
||||
protected void createZone() {
|
||||
api.getZoneApi().delete(zoneName);
|
||||
api.getZoneApi().createInAccount(zoneName, account.getId());
|
||||
zoneId = getZoneByName(zoneName).get().getId();
|
||||
}
|
||||
|
||||
protected Optional<Zone> getZoneByName(final String zoneName) {
|
||||
return api.getZoneApi().listByAccount(account.getId()).firstMatch(new Predicate<Zone>() {
|
||||
public boolean apply(Zone in) {
|
||||
return in.getName().equals(zoneName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@AfterClass(groups = { "integration", "live" })
|
||||
protected void tearDown() {
|
||||
if (zoneId != null)
|
||||
api.getZoneApi().delete(zoneName);
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:addDirectionalPool><transactionID /><AddDirectionalPoolData dirPoolType="GEOLOCATION" poolRecordType="A" zoneName="jclouds.org." hostName="www.jclouds.org." description="foo"/></v01:addDirectionalPool></soapenv:Body></soapenv:Envelope>
|
|
@ -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:addDirectionalPoolRecord><transactionID /><AddDirectionalRecordData directionalPoolId="06063DC355055E68" createAllNonConfiguredGrp="true"><DirectionalRecordConfiguration recordType="A" TTL="300" noResponseRecord="false" ><InfoValues Info1Value="1.1.0.1" /></DirectionalRecordConfiguration></AddDirectionalRecordData></v01:addDirectionalPoolRecord></soapenv:Body></soapenv:Envelope>
|
|
@ -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:addDirectionalPoolRecord><transactionID /><AddDirectionalRecordData directionalPoolId="06063DC355055E68"><DirectionalRecordConfiguration recordType="A" TTL="300" noResponseRecord="false" ><InfoValues Info1Value="1.1.0.1" /></DirectionalRecordConfiguration><GeolocationGroupData><GroupData groupingType="ASSIGN_EXISTING_GROUP" assignExistingGroupId="AAABBBCCCDDDEEE" /></GeolocationGroupData></AddDirectionalRecordData></v01:addDirectionalPoolRecord></soapenv:Body></soapenv:Envelope>
|
|
@ -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:addDirectionalPoolRecord><transactionID /><AddDirectionalRecordData directionalPoolId="06063DC355055E68"><DirectionalRecordConfiguration recordType="A" TTL="300" noResponseRecord="false" ><InfoValues Info1Value="1.1.0.1" /></DirectionalRecordConfiguration><GeolocationGroupData><GroupData groupingType="DEFINE_NEW_GROUP" /><GeolocationGroupDetails groupName="Mexas" description="Clients we classify as being in US" ><GeolocationGroupDefinitionData regionName="United States (US)" territoryNames="Maryland;Texas" /></GeolocationGroupDetails></GeolocationGroupData></AddDirectionalRecordData></v01:addDirectionalPoolRecord></soapenv:Body></soapenv:Envelope>
|
|
@ -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:deleteDirectionalPoolRecord><transactionID /><dirPoolRecordId>04053D8E57C7931F</dirPoolRecordId></v01:deleteDirectionalPoolRecord></soapenv:Body></soapenv:Envelope>
|
|
@ -0,0 +1,16 @@
|
|||
<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">7021</errorCode>
|
||||
<errorDescription xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Geolocation/Source IP overlap(s) found: Region: Utah (Group: US )</errorDescription>
|
||||
</ns1:UltraWSException>
|
||||
</detail>
|
||||
</soap:Fault>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,18 @@
|
|||
<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.jclouds.org.</errorDescription>
|
||||
</ns1:UltraWSException>
|
||||
</detail>
|
||||
</soap:Fault>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,8 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns1:addDirectionalPoolResponse
|
||||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<DirPoolID xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">06063DC355055E68</DirPoolID>
|
||||
</ns1:addDirectionalPoolResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,8 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns1:deleteDirectionalPoolResponse
|
||||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<result xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Successful</result>
|
||||
</ns1:deleteDirectionalPoolResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,16 @@
|
|||
<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">4009</errorCode>
|
||||
<errorDescription xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Resource Record already exists.</errorDescription>
|
||||
</ns1:UltraWSException>
|
||||
</detail>
|
||||
</soap:Fault>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,9 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns1:addDirectionalPoolRecordResponse
|
||||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<DirectionalPoolRecordID
|
||||
xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">06063DC355058294</DirectionalPoolRecordID>
|
||||
</ns1:addDirectionalPoolRecordResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,8 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns1:deleteDirectionalPoolRecordResponse
|
||||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<result xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Successful</result>
|
||||
</ns1:deleteDirectionalPoolRecordResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,16 @@
|
|||
<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">2705</errorCode>
|
||||
<errorDescription xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Directional Pool Record does not exist in the system</errorDescription>
|
||||
</ns1:UltraWSException>
|
||||
</detail>
|
||||
</soap:Fault>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,8 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns1:updateDirectionalPoolRecordResponse
|
||||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<result xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Successful</result>
|
||||
</ns1:updateDirectionalPoolRecordResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -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:updateDirectionalPoolRecord><transactionID /><UpdateDirectionalRecordData directionalPoolRecordId="04053D8E57C7931F"><DirectionalRecordConfiguration TTL="300" ><InfoValues Info1Value="1.1.0.1" /></DirectionalRecordConfiguration></UpdateDirectionalRecordData></v01:updateDirectionalPoolRecord></soapenv:Body></soapenv:Envelope>
|
|
@ -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:updateDirectionalPoolRecord><transactionID /><UpdateDirectionalRecordData directionalPoolRecordId="04053D8E57C7931F"><DirectionalRecordConfiguration TTL="300" ><InfoValues Info1Value="1.1.0.1" /></DirectionalRecordConfiguration><GeolocationGroupDetails groupName="Mexas" description="Clients we classify as being in US" ><GeolocationGroupDefinitionData regionName="United States (US)" territoryNames="Maryland;Texas" /></GeolocationGroupDetails></UpdateDirectionalRecordData></v01:updateDirectionalPoolRecord></soapenv:Body></soapenv:Envelope>
|
Loading…
Reference in New Issue