Search in sources :

Example 1 with ScratchDisks

use of com.google.api.services.compute.model.MachineType.ScratchDisks in project google-cloud-java by GoogleCloudPlatform.

the class MachineType method toPb.

com.google.api.services.compute.model.MachineType toPb() {
    com.google.api.services.compute.model.MachineType machineTypePb = new com.google.api.services.compute.model.MachineType();
    if (generatedId != null) {
        machineTypePb.setId(new BigInteger(generatedId));
    }
    if (creationTimestamp != null) {
        machineTypePb.setCreationTimestamp(TIMESTAMP_FORMATTER.print(creationTimestamp));
    }
    machineTypePb.setName(machineTypeId.getType());
    machineTypePb.setDescription(description);
    machineTypePb.setSelfLink(machineTypeId.getSelfLink());
    machineTypePb.setGuestCpus(cpus);
    machineTypePb.setMemoryMb(memoryMb);
    if (scratchDisksSizeGb != null) {
        machineTypePb.setScratchDisks(Lists.transform(scratchDisksSizeGb, new Function<Integer, ScratchDisks>() {

            @Override
            public ScratchDisks apply(Integer diskSize) {
                return new ScratchDisks().setDiskGb(diskSize);
            }
        }));
    }
    machineTypePb.setMaximumPersistentDisks(maximumPersistentDisks);
    machineTypePb.setMaximumPersistentDisksSizeGb(maximumPersistentDisksSizeGb);
    machineTypePb.setZone(machineTypeId.getZoneId().getZone());
    if (deprecationStatus != null) {
        machineTypePb.setDeprecated(deprecationStatus.toPb());
    }
    return machineTypePb;
}
Also used : BigInteger(java.math.BigInteger) Function(com.google.common.base.Function) BigInteger(java.math.BigInteger) ScratchDisks(com.google.api.services.compute.model.MachineType.ScratchDisks)

Aggregations

ScratchDisks (com.google.api.services.compute.model.MachineType.ScratchDisks)1 Function (com.google.common.base.Function)1 BigInteger (java.math.BigInteger)1