this.credentialStore = checkNotNull(credentialStore, "credentialStore cannot be null");
}
@Override
public Image apply(DriveInfo drive) {
WellKnownImage input = preinstalledImages.get().get(drive.getUuid());
// set credentials in the store here, as opposed to directly modifying the image. we need to
// set credentials on the image outside of this function so that they can be for example
// overridden by properties
credentialStore.put("image#" + drive.getUuid(), LoginCredentials.builder().user(input.getLoginUser()).build());
return new ImageBuilder()
.ids(drive.getUuid())
.userMetadata(
ImmutableMap.<String, String> builder().putAll(drive.getUserMetadata())
.put("size", input.getSize() + "").build())
.location(locationSupplier.get())
.name(input.getDescription())
.description(drive.getName())
.status(Status.AVAILABLE)
.operatingSystem(
new OperatingSystem.Builder().family(input.getOsFamily()).version(input.getOsVersion())
.name(input.getDescription()).description(drive.getName()).is64Bit(input.is64bit()).build())
.version("").build();
}