I'm trying to get all the configurations for hourly bare metal servers on SoftLayer, but failed. Is there a Java sample for it?
What I want to get is the items like in the following link (DataCenter name, OS list, CPU/GPU list, etc): https://gist.github.com/bmpotter/a0d9a386d8681bdab456/revisions
I can get the OS reference code list with following codes, but this is the only one that I can get now :)
Hardware.Service hardwareService = Hardware.service(client);
Configuration configuration = hardwareService.getCreateObjectOptions();
List<Option> options = configuration.getOperatingSystems();
for (Option option : options) {
Hardware hardware = option.getTemplate();
String osRefCode = hardware.getOperatingSystemReferenceCode();
System.out.println("osRefCode : " + osRefCode );
}
I cannot get DataCenter name list and other configurations (E.g. cpu count) with following codes:
List<Option> options = configuration.getDatacenters();
for (Option option : options) {
Hardware hardware = option.getTemplate();
String dcName = hardware.getDatacenterName();
System.out.println("dcName : " + dcName );
}
There should be something wrong, but I don't know why.
It will be great if there is a Java Sample codes for this.
Thanks.
I recomend you to debug your code in order to know how you need to access the properties properly, I got some values for you: