public class BindOSImageParamsToXmlPayload implements Binder {
@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
OSImageParams params = OSImageParams.class.cast(input);
try {
return (R) request.toBuilder().payload(XMLBuilder.create("OSImage").a("xmlns", "http://schemas.microsoft.com/windowsazure")
.e("Label").t(params.getLabel()).up()
.e("MediaLink").t(params.getMediaLink().toASCIIString()).up()
.e("Name").t(params.getName()).up()
.e("OS").t(params.getOS().toString()).up()
.up().asString()).build();
} catch (Exception e) {
throw Throwables.propagate(e);
}