/** * Creates instance options based on another instance. All properties are the same as the * original instance's except: - disks (persistent disks are only attached to an instance) - * networkInterfaces (these are instance specific) */ public static InstanceTemplate fromInstance(Instance instance) { return InstanceTemplate.builder() .forMachineTypeAndNetwork( instance.getMachineType(), instance.getNetworkInterfaces().iterator().next().getNetwork()) .description(instance.getDescription().orNull()) .tags(instance.getTags()) .image(instance.getImage()) .metadata(instance.getMetadata()) .zone(instance.getZone()) .serviceAccounts(instance.getServiceAccounts()); }
public Builder fromInstance(Instance in) { return super.fromResource(in) .tags(in.getTags()) .image(in.getImage()) .machineType(in.getMachineType()) .status(in.getStatus()) .statusMessage(in.getStatusMessage().orNull()) .zone(in.getZone()) .networkInterfaces(in.getNetworkInterfaces()) .disks(in.getDisks()) .metadata(in.getMetadata()) .serviceAccoutns(in.getServiceAccounts()); }