コード例 #1
0
 /**
  * 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());
 }
コード例 #2
0
ファイル: Instance.java プロジェクト: hpcloud/jclouds-labs
 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());
 }