@Override public Hardware apply(MachineType input) { URI zoneLink = URI.create( input.selfLink().toString().replace("/machineTypes/" + input.name(), "")); Location zone = locationsByUri.get().get(zoneLink); if (zone == null) { throw new IllegalStateException( String.format("zone %s not present in %s", zoneLink, locationsByUri.get().keySet())); } return new HardwareBuilder() .id(input.selfLink().toString()) .providerId(input.id()) .location(zone) .name(input.name()) .hypervisor("kvm") .processor(new Processor(input.guestCpus(), 1.0)) .providerId(input.id()) .ram(input.memoryMb()) .uri(input.selfLink()) .volumes(collectVolumes(input)) .supportsImage(Predicates.<Image>alwaysTrue()) .build(); }
@Override public Hardware apply(MachineType input) { URI zoneLink = URI.create( input.selfLink().toString().replace("/machineTypes/" + input.name(), "")); Location zone = locationsByUri.get().get(zoneLink); if (zone == null) { throw new IllegalStateException( String.format("zone %s not present in %s", zoneLink, locationsByUri.get().keySet())); } return new HardwareBuilder() .id(input.selfLink().toString()) .providerId(input.id()) .location(zone) .name(input.name()) .hypervisor("kvm") .processor(new Processor(input.guestCpus(), 1.0)) .providerId(input.id()) .ram(input.memoryMb()) .uri(input.selfLink()) .volumes(collectVolumes(input)) .supportsImage(Predicates.<Image>alwaysTrue()) .build(); }
@Override public Hardware apply(MachineType input) { URI zoneLink = URI.create( input.selfLink().toString().replace("/machineTypes/" + input.name(), "")); Location zone = locationsByUri.get().get(zoneLink); if (zone == null) { throw new IllegalStateException( String.format("zone %s not present in %s", zoneLink, locationsByUri.get().keySet())); } return new HardwareBuilder() .id(input.selfLink().toString()) .providerId(input.id()) .location(zone) .name(input.name()) .hypervisor("kvm") .processor(new Processor(input.guestCpus(), 1.0)) .providerId(input.id()) .ram(input.memoryMb()) .uri(input.selfLink()) .volumes(collectVolumes(input)) .supportsImage(Predicates.<Image>alwaysTrue()) .build(); }
@Override public Hardware apply(MachineType input) { URI zoneLink = URI.create( input.selfLink().toString().replace("/machineTypes/" + input.name(), "")); Location zone = locationsByUri.get().get(zoneLink); if (zone == null) { throw new IllegalStateException( String.format("zone %s not present in %s", zoneLink, locationsByUri.get().keySet())); } return new HardwareBuilder() .id(input.selfLink().toString()) .providerId(input.id()) .location(zone) .name(input.name()) .hypervisor("kvm") .processor(new Processor(input.guestCpus(), 1.0)) .providerId(input.id()) .ram(input.memoryMb()) .uri(input.selfLink()) .volumes(collectVolumes(input)) .supportsImage(Predicates.<Image>alwaysTrue()) .build(); }
public void testListHardwareProfiles() throws Exception { GoogleComputeEngineApi api = client.getContext().unwrapApi(GoogleComputeEngineApi.class); ImmutableSet.Builder<String> deprecatedMachineTypes = ImmutableSet.builder(); for (MachineType machine : api.machineTypesInZone(DEFAULT_ZONE_NAME).list().next()) { if (machine.deprecated() != null) { deprecatedMachineTypes.add(machine.id()); } } ImmutableSet<String> deprecatedMachineTypeIds = deprecatedMachineTypes.build(); for (Hardware hardwareProfile : client.listHardwareProfiles()) { assertFalse(contains(deprecatedMachineTypeIds, hardwareProfile.getId())); } }