@Override public Set<? extends Hardware> get() { Set<Hardware> hardware = Sets.newHashSet(); for (int cpus : new int[] { 1, 2, 4, 8 }) for (int ram : new int[] { 512, 1024, 2048, 4096, 8192, 16384 }) { String id = String.format("cpu=%d,ram=%s,disk=%d", cpus, ram, 10); hardware.add(new HardwareBuilder().ids(id).ram(ram).processors(ImmutableList.of(new Processor(cpus, 1.0))) .volumes(ImmutableList.<Volume> of(new VolumeImpl(10f, true, true))).build()); } return hardware; } }
@Override public Set<? extends Hardware> get() { Set<Hardware> hardware = Sets.newHashSet(); for (int cpus : new int[] { 1, 2, 4, 8 }) for (int ram : new int[] { 512, 1024, 2048, 4096, 8192, 16384 }) { String id = String.format("cpu=%d,ram=%s,disk=%d", cpus, ram, 10); hardware.add(new HardwareBuilder().ids(id).ram(ram).processors(ImmutableList.of(new Processor(cpus, 1.0))) .volumes(ImmutableList.<Volume> of(new VolumeImpl(10f, true, true))).build()); } return hardware; } }
@Override public Set<? extends Hardware> get() { Set<Hardware> hardware = Sets.newHashSet(); for (int cpus : new int[] { 1, 2, 4, 8 }) for (int ram : new int[] { 512, 1024, 2048, 4096, 8192, 16384 }) { String id = String.format("cpu=%d,ram=%s,disk=%d", cpus, ram, 10); hardware.add(new HardwareBuilder().ids(id).ram(ram).processors(ImmutableList.of(new Processor(cpus, 1.0))) .volumes(ImmutableList.<Volume> of(new VolumeImpl(10f, true, true))).hypervisor("VMware").build()); } return hardware; } }
@Override public Hardware apply(org.jclouds.servermanager.Hardware from) { HardwareBuilder builder = new HardwareBuilder(); builder.ids(from.id + ""); builder.name(from.name); builder.processors(ImmutableList.of(new Processor(from.cores, 1.0))); builder.ram(from.ram); builder.volumes(ImmutableList.<Volume> of(new VolumeImpl(from.disk, true, false))); return builder.build(); }
static Hardware stub(String type, int cores, int ram, float disk) { return new org.jclouds.compute.domain.HardwareBuilder().ids(type).name(type) .processors(ImmutableList.of(new Processor(cores, 1.0))).ram(ram) .volumes(ImmutableList.<Volume> of(new VolumeImpl(disk, true, false))).build(); }
static Hardware stub(String type, int cores, int ram, float disk) { return new org.jclouds.compute.domain.HardwareBuilder().ids(type).name(type) .processors(ImmutableList.of(new Processor(cores, 1.0))).ram(ram) .volumes(ImmutableList.<Volume> of(new VolumeImpl(disk, true, false))).build(); }
static Hardware stub(String type, int cores, int ram, float disk) { return new org.jclouds.compute.domain.HardwareBuilder().ids(type).name(type) .processors(ImmutableList.of(new Processor(cores, 1.0))).ram(ram) .volumes(ImmutableList.<Volume> of(new VolumeImpl(disk, true, false))).build(); }
@Override public Hardware apply(org.jclouds.servermanager.Hardware from) { HardwareBuilder builder = new HardwareBuilder(); builder.ids(from.id + ""); builder.name(from.name); builder.processors(ImmutableList.of(new Processor(from.cores, 1.0))); builder.ram(from.ram); builder.volumes(ImmutableList.<Volume> of(new VolumeImpl(from.disk, true, false))); return builder.build(); }
static Hardware stub(String type, int cores, int ram, float disk) { return new org.jclouds.compute.domain.HardwareBuilder().ids(type).name(type) .processors(ImmutableList.of(new Processor(cores, 1.0))).ram(ram) .volumes(ImmutableList.<Volume> of(new VolumeImpl(disk, true, false))).build(); }
@Override public Hardware apply(ServerSpec spec) { Location location = FluentIterable.from(locations.get()).firstMatch(idEquals(spec.getDatacenter())).orNull(); assert location != null : String.format("no location matched ServerSpec %s", spec); return new HardwareBuilder().ids(spec.toString()).ram(spec.getMemorySizeMB()).processors( ImmutableList.of(new Processor(spec.getCpuCores(), 1.0))).volumes( ImmutableList.<Volume> of(new VolumeImpl((float) spec.getDiskSizeGB(), true, true))).hypervisor( spec.getPlatform()).location(location).supportsImage( ImagePredicates.idEquals(spec.getTemplateName())).build(); } }
@Override public Hardware apply(ServerSpec spec) { Location location = FluentIterable.from(locations.get()).firstMatch(idEquals(spec.getDatacenter())).orNull(); assert location != null : String.format("no location matched ServerSpec %s", spec); return new HardwareBuilder().ids(spec.toString()).ram(spec.getMemorySizeMB()).processors( ImmutableList.of(new Processor(spec.getCpuCores(), 1.0))).volumes( ImmutableList.<Volume> of(new VolumeImpl((float) spec.getDiskSizeGB(), true, true))).hypervisor( spec.getPlatform()).location(location).supportsImage( ImagePredicates.idEquals(spec.getTemplateName())).build(); } }
public Hardware apply(Flavor from) { return new HardwareBuilder().ids(from.getId() + "").name(from.getName()).hypervisor("xen") .processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))).ram(from.getRam()) .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDisk(), true, true))).build(); } }
public Hardware apply(Flavor from) { return new HardwareBuilder().ids(from.getId() + "").name(from.getName()).hypervisor("xen") .processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))).ram(from.getRam()) .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDisk(), true, true))).build(); } }
public Hardware apply(Flavor from) { return new HardwareBuilder().ids(from.getId() + "").name(from.getName()).hypervisor("xen") .processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))).ram(from.getRam()) .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDisk(), true, true))).build(); } }
public Hardware apply(Flavor from) { return new HardwareBuilder() .ids(from.getId() + "") .name(from.getName()) .processors(ImmutableList.of(new Processor(from.getDisk() / 10.0, 1.0))) .ram(from.getRam()) .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDisk(), true, true))) .uri(from.getURI()) .build(); } }
@SuppressWarnings("unchecked") public static HardwareBuilder fromHardware(Hardware in) { return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name( in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors( List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes())) .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor()); } }
@SuppressWarnings("unchecked") public static HardwareBuilder fromHardware(Hardware in) { return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name( in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors( List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes())) .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor()); } }
@Override public Hardware apply(Plan plan) { HardwareBuilder builder = new HardwareBuilder() .ids(plan.slug()) .name(plan.name()) .hypervisor("none") .processors(getProcessors(plan)) .ram(getMemory(plan)) .volumes(getVolumes(plan)); return builder.build(); }
@SuppressWarnings("unchecked") public static HardwareBuilder fromHardware(Hardware in) { return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name( in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors( List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes())) .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor()); } }
@SuppressWarnings("unchecked") public static HardwareBuilder fromHardware(Hardware in) { return new HardwareBuilder().id(in.getId()).providerId(in.getProviderId()).location(in.getLocation()).name( in.getName()).uri(in.getUri()).userMetadata(in.getUserMetadata()).tags(in.getTags()).processors( List.class.cast(in.getProcessors())).ram(in.getRam()).volumes(List.class.cast(in.getVolumes())) .supportsImage(in.supportsImage()).hypervisor(in.getHypervisor()); } }