jclouds/jclouds — pull request #1546 by adriancole (2013-04-18 01:23:53+00:00)
Title: added code and tests for geo-based write ops in ultradns

This adds the ability to manipulate directional DNS. For example, you can setup multiple sites and migrate users coming from one to another.

ex.

```
// all territories in EU
eu = DirectionalGroup.builder()
.name("EU")
.description("Clients we classify as being in Europe")
.mapRegion("Europe").build();

REGION_US = "United States (US)";

// pick one state
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 availableRegions = api.getRegionsByIdAndName();

// find the us Territories
Iterable usTerritories = filterKeys(availableRegions,
IdAndName.nameEqualTo(REGION_US)).values();

// choose all territories except nebraska
us = DirectionalGroup.builder()
.name("US")
.description("Clients we classify as being in US")
.mapRegionToTerritories(REGION_US,
filter(usTerritories, not(equalTo("Nebraska")))).build();

recordEU = DirectionalPoolRecord.drBuilder()
.type("CNAME")
.ttl(8600)
.rdata("eu." + dname).build();

recordUS = DirectionalPoolRecord.drBuilder()
.type("CNAME")
.ttl(300)
.rdata("us." + dname).build();

recordCanary = DirectionalPoolRecord.drBuilder()
.type("CNAME")
.ttl(300)
.rdata("canary." + dname).build();

idEU = api(zoneName).addRecordIntoNewGroup(cnamePoolId, recordEU, eu);
idUS = api(zoneName).addRecordIntoNewGroup(cnamePoolId, recordUS, us);
idCanary = api(zoneName).addRecordIntoNewGroup(cnamePoolId, recordCanary, nebraska);
```