jclouds/jclouds-labs — pull request #42 by everett-toews (2013-04-08 18:09:41+00:00)
Title: The Record API for Rackspace Cloud DNS.

@adriancole I know this looks like a big PR but the Record API is very very similar to the Domain API and I basically followed the Domain API pattern.

One thing I do want to point out is that I went with the UpdateRecord style for updating records. I tried the way you suggested but actually found that more difficult to use. There are a number of reasons I went with UpdateRecord.

* You can update one or many records. For one the id is in the URL path, for many it's in the content payload. Trying to get the id in there for both ways via inheritance or composition was awkward. Splitting out UpdateRecord was cleaner.
* The code for doing Record and RecordMetadata via inheritance or composition just kept getting nastier. Splitting out UpdateRecord was cleaner.
* There are lots of rules for updating records that can be made clear in the Javadoc of a separate UpdateRecord.
* An UpdateRecord class is a clear signal to users what the class is for.
* It's consistent with other classes in the API.
* Working with it seemed really easy to me.

```java
List records = dnsApi.getRecordApi().list(domainId).concat().toImmutableList();
List updateRecords = Lists.newArrayList();

for (Record record: records) {
if (record.getType().equals("A")) {
updateRecords.add(UpdateRecord.builder(record).comment("Multi-record Update").build());
}
}

Records.update(dnsApi, domainId, updateRecords);
```
Live tests run 100%

mvn -Plive -Dtest.jclouds.keystone.credential-type=passwordCredentials -Dtest.rackspace-clouddns.identity=username -Dtest.rackspace-clouddns.credential=password clean install

Will cherry pick into 1.6.x when merged.

Up next is the Reverse DNS API. http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/ReverseDNS-123456999.html

I'm hoping to get all of this done in time for jclouds RC.4 and get this and the providers into jclouds/jclouds/1.6.x.