in profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/binder/server/CreateServerRequestBinder.java [41:85]
protected String createPayload(Server.Request.CreatePayload payload) {
checkNotNull(payload.dataCenterId(), "dataCenterId");
dataCenterId = payload.dataCenterId();
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("name", payload.name());
properties.put("ram", payload.ram());
properties.put("cores", payload.cores());
if (payload.availabilityZone() != null)
properties.put("availabilityzone", payload.availabilityZone());
if (payload.licenceType() != null)
properties.put("licencetype", payload.licenceType());
if (payload.bootVolume() != null)
properties.put("bootVolume", payload.bootVolume());
else if (payload.bootCdrom() != null)
properties.put("bootCdrom", payload.bootCdrom());
if (payload.cpuFamily() != null)
properties.put("cpuFamily", payload.cpuFamily());
requestBuilder.put("properties", properties);
Server.Entities entities = payload.entities();
if (entities != null) {
Map<String, Object> entitiesParams = new HashMap<String, Object>();
if (entities.volumes() != null)
entitiesParams.put("volumes", entities.volumes());
if (entities.nics() != null)
entitiesParams.put("nics", entities.nics());
requestBuilder.put("entities", entitiesParams);
}
return jsonBinder.toJson(requestBuilder);
}