/**
* @param args
*/
public static void main(String[] args) {
KeystoneTokenProvider keystone = new KeystoneTokenProvider(
ExamplesConfiguration.KEYSTONE_AUTH_URL,
ExamplesConfiguration.KEYSTONE_USERNAME,
ExamplesConfiguration.KEYSTONE_PASSWORD);
Access access = keystone.getAccessByTenant(ExamplesConfiguration.TENANT_NAME);
Service glanceService = null;
for (Service service : access.getServiceCatalog()) {
if (service.getType().equals("image")) {
glanceService = service;
break;
}
}
if (glanceService == null) {
throw new RuntimeException("Glance service not found");
}
for (Endpoint endpoint : glanceService.getEndpoints()) {
Glance glance = new Glance(endpoint.getPublicURL() + "/v1");
glance.setTokenProvider(keystone
.getProviderByTenant(ExamplesConfiguration.TENANT_NAME));
// Creating a new image
Image newImage = new Image();
newImage.setDiskFormat("raw");