use of org.platformlayer.core.model.PlatformLayerKey in project platformlayer by platformlayer.
the class FederatedPlatformLayerClient method mapToChildForCreate.
private MappedPlatformLayerKey mapToChildForCreate(PlatformLayerKey plk) {
if (plk.getItemId() != null) {
throw new IllegalArgumentException();
}
FederationMapping childKey = federationMap.getClientForCreate(plk);
ManagedItemId childItemId;
ChildClient childClient = getClient(childKey);
childItemId = null;
MappedPlatformLayerKey mapped = new MappedPlatformLayerKey();
mapped.child = childClient;
mapped.key = new PlatformLayerKey(childKey.host, childKey.project, plk.getServiceType(), plk.getItemType(), childItemId);
return mapped;
}
use of org.platformlayer.core.model.PlatformLayerKey in project platformlayer by platformlayer.
the class FederatedPlatformLayerClient method listItems.
@Override
public <T> List<T> listItems(final Class<T> clazz) throws PlatformLayerClientException {
JaxbHelper jaxbHelper = PlatformLayerClientBase.toJaxbHelper(clazz, ManagedItemCollection.class);
PlatformLayerKey path = PlatformLayerClientBase.toKey(jaxbHelper, null, listServices(true));
return doListConcatenationTyped(getChildClients(path), AddHostTyped.wrap(new ListItemsTyped<T>(clazz)));
}
use of org.platformlayer.core.model.PlatformLayerKey in project platformlayer by platformlayer.
the class TypedPlatformLayerClient method toKey.
public <T> PlatformLayerKey toKey(Class<T> itemClass, String id) throws PlatformLayerClientException {
JaxbHelper jaxbHelper = PlatformLayerClientBase.toJaxbHelper(itemClass, new Class[0]);
ManagedItemId itemId = new ManagedItemId(id);
PlatformLayerKey key = PlatformLayerClientBase.toKey(jaxbHelper, itemId, itemClass, platformLayerClient.listServices(true));
return key;
}
use of org.platformlayer.core.model.PlatformLayerKey in project platformlayer by platformlayer.
the class ImageFactory method getOrCreateImageId.
public CloudImage getOrCreateImageId(MachineProvider targetCloud, List<ImageFormat> formats, PlatformLayerKey recipeKey) throws OpsException {
if (recipeKey == null) {
log.debug("Looking for bootstrap image");
for (ImageFormat format : formats) {
CloudImage bootstrapImage = findBootstrapImage(format, cloud.getImageStore(targetCloud));
if (bootstrapImage != null) {
return bootstrapImage;
// Tags tags = bootstrapImage.getTags();
// String compression = tags.findUnique("org.openstack.sync__1__expand");
// return new ImageInfo(bootstrapImage.getId(), format, compression);
}
}
throw new OpsException("Cannot find bootstrap image for format " + Joiner.on(",").join(formats));
}
DiskImage imageTemplate = new DiskImage();
imageTemplate.setFormat(formats.get(0).name());
imageTemplate.setRecipeId(recipeKey);
String id = "image-" + recipeKey.getItemId().getKey();
imageTemplate.setKey(PlatformLayerKey.fromId(id));
PlatformLayerKey cloudKey = targetCloud.getModel().getKey();
imageTemplate.setCloud(cloudKey);
DiskImage image = getOrCreateImage(imageTemplate);
return getImageInfo(image);
}
use of org.platformlayer.core.model.PlatformLayerKey in project platformlayer by platformlayer.
the class ImageFactory method getOrCreateImageId.
public CloudImage getOrCreateImageId(MachineProvider targetCloud, List<ImageFormat> formats, DiskImageRecipe recipeTemplate) throws OpsException {
DiskImageRecipe recipeItem = getOrCreateRecipe(recipeTemplate);
PlatformLayerKey recipeKey = recipeItem.getKey();
return getOrCreateImageId(targetCloud, formats, recipeKey);
}
Aggregations