Package io.fathom.cloud.compute.api.aws.ec2.model

Examples of io.fathom.cloud.compute.api.aws.ec2.model.Instance


     * @param instanceId
     *            instance we're checking
     * @return vpc id, or null if not a vpc instance
     */
    String getVpcId(String instanceId) {
        Instance awsInstance = describeInstance(instanceId);

        String vpcId = awsInstance.getVpcId();
        if (Strings.isNullOrEmpty(vpcId)) {
            return null;
        }

        return vpcId;
View Full Code Here


    checkState(isConfigured(), "attempt to use unconfigured ScalingGroup");

    List<Machine> startedMachines = Lists.newArrayList();
    try {
      for (int i = 0; i < count; i++) {
        Instance newInstance = launchInstance(scaleUpConfig);
        startedMachines.add(InstanceToMachine.convert(newInstance));

        newInstance = awaitIpAddress(newInstance);
        startedMachines.set(i, InstanceToMachine.convert(newInstance));
View Full Code Here

  }

  private Instance launchInstance(ScaleUpConfig scaleUpConfig)
      throws ScalingGroupException {
    try {
      Instance launchedInstance = this.client
          .launchInstance(scaleUpConfig);
      // refresh meta data
      return this.client.getInstanceMetadata(launchedInstance
          .getInstanceId());
    } catch (Exception e) {
      throw new ScalingGroupException(format(
          "failed to launch instance: %s", e.getMessage()), e);
    }
View Full Code Here

      this.instanceId = instanceId;
    }

    @Override
    public String call() throws Exception {
      Instance instance = this.client
          .getInstanceMetadata(this.instanceId);
      checkState(instance.getPublicIpAddress() != null,
          "instance has not been assigned a public IP address");
      return instance.getPublicIpAddress();
    }
View Full Code Here

    // no particular availability zone
    String availabilityZone = null;
    String bootscript = Joiner.on("\n").join(
        provisioningDetails.getBootScript());

    Instance startedInstance = new CreateInstance(awsCredentials(),
        region(), availabilityZone,
        provisioningDetails.getSecurityGroups(),
        provisioningDetails.getKeyPair(),
        provisioningDetails.getSize(), provisioningDetails.getImage(),
        bootscript).call();
View Full Code Here

      this.instanceId = instanceId;
    }

    @Override
    public String call() throws Exception {
      Instance instance = this.client
          .getInstanceMetadata(this.instanceId);
      checkState(instance.getPublicIpAddress() != null,
          "instance has not been assigned a public IP address");
      return instance.getPublicIpAddress();
    }
View Full Code Here

    }

  }

  private InstanceStateName stateFrom(final String instanceId) {
    final Instance instance = findInstance(instanceId);
    return InstanceStateName.fromValue(instance.getState().getName());
  }
View Full Code Here

  /**
   * http://shlomoswidler.com/2009/07/ec2-instance-life-cycle.html
   */
  public void instanceStart(final String instanceId) throws Exception {

    final Instance instance = findInstance(instanceId);

    final InstanceStateName state = stateFrom(instance);

    logger.info("start: current state=" + state);

View Full Code Here

  /**
   * http://shlomoswidler.com/2009/07/ec2-instance-life-cycle.html
   */
  public void instanceStop(final String instanceId) throws Exception {

    final Instance instance = findInstance(instanceId);

    final InstanceStateName state = stateFrom(instance);

    logger.info("stop: current state=" + state);

View Full Code Here

    final long timeStart = System.currentTimeMillis();

    while (true) {

      final Instance instance = findInstance(instanceId);

      if (isTimeoutPending(timeStart)) {
        logger.error("instance state : timeout");
        throw new Exception("timeout");
      }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.compute.api.aws.ec2.model.Instance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.