In Softlayer Portal, what Java API can retrieve the data on Audit Log view. I am developing a portal page using Java Client API. If you choose one of the actions in the device list, you can get into the page below.. If you share a python sample code, it will be helpful as well.
Looking for your feedback.. Thank you
Mike
Please try this java example to get the Audit log items using the SoftLayer_Event_Log::getAllObjects
import java.util.Iterator;
import java.util.List;
import com.softlayer.api.ApiClient;
import com.softlayer.api.RestApiClient;
import com.softlayer.api.ResultLimit;
import com.softlayer.api.service.event.Log;
public class getAllObjects {
public static void main(String[] args) {
String username = "set me";
String apikey = "set me";
ApiClient client = new RestApiClient().withCredentials(username, apikey).withLoggingEnabled();
com.softlayer.api.service.event.Log.Service eventLogService = com.softlayer.api.service.event.Log.service(client);
eventLogService.setResultLimit(new ResultLimit(0,50));
List<Log> a = eventLogService.getAllObjects();
Iterator<Log> iterator = a.iterator();
int idx = 0;
while (iterator.hasNext()) {
Log data = iterator.next();
System.out.println(" Data: " + idx);
System.out.println(" UserName: " + data.getUsername());
System.out.println(" userType: " + data.getUserType());
System.out.println(" Action: " + data.getEventName());
idx++;
}
}
}
In the script was added “result Limits” in order to get more items than by default (amount by default displayed= 25 last items).
Some references:
http://sldn.softlayer.com/reference/services/SoftLayer_Event_Log/getAllObjects https://github.com/softlayer/softlayer-java/blob/master/examples/src/main/java/com/softlayer/api/example/Pagination.java http://sldn.softlayer.com/article/rest Section: Using Result Limits