List of usage examples for com.amazonaws.services.ec2.model InstanceState InstanceState
InstanceState
From source file:jp.primecloud.auto.aws.typica.converter.InstanceConverter.java
License:Open Source License
@Override protected Instance convertObject(com.xerox.amazonws.ec2.ReservationDescription.Instance from) { Instance to = new Instance(); to.setInstanceId(from.getInstanceId()); to.setImageId(from.getImageId());//from w w w . j a va 2s. c o m InstanceState state = new InstanceState(); state.setCode(from.getStateCode()); state.setName(from.getState()); to.setState(state); to.setPrivateDnsName(from.getPrivateDnsName()); to.setPublicDnsName(from.getDnsName()); to.setStateTransitionReason(from.getReason()); to.setKeyName(from.getKeyName()); to.setAmiLaunchIndex(null); to.setProductCodes(null); to.setInstanceType(from.getInstanceType().name()); to.setLaunchTime(from.getLaunchTime().getTime()); Placement placement = new Placement(); placement.setAvailabilityZone(from.getAvailabilityZone()); placement.setGroupName(null); // to.setPlacement(placement); to.setKernelId(from.getKernelId()); to.setRamdiskId(from.getRamdiskId()); to.setPlatform(from.getPlatform()); Monitoring monitoring = new Monitoring(); monitoring.setState(Boolean.toString(from.isMonitoring())); to.setMonitoring(monitoring); // to.setSubnetId(null); to.setVpcId(null); to.setPrivateIpAddress(null); to.setPublicIpAddress(null); to.setStateReason(null); //to.setArchitecture(null); to.setRootDeviceName(null); to.setRootDeviceName(null); to.setBlockDeviceMappings(null); //to.setVirtualizationType(null); //to.setInstanceLifecycle(null); to.setSpotInstanceRequestId(null); //to.setLicense(null); to.setClientToken(null); to.setTags(null); return to; }
From source file:jp.primecloud.auto.aws.typica.converter.InstanceStateChangeTerminateConverter.java
License:Open Source License
@Override protected InstanceStateChange convertObject(TerminatingInstanceDescription from) { InstanceStateChange to = new InstanceStateChange(); to.setInstanceId(from.getInstanceId()); InstanceState previousState = new InstanceState(); previousState.setCode(from.getPreviousStateCode()); previousState.setName(from.getPreviousState()); to.setPreviousState(previousState);/*w ww. j a va 2 s. c om*/ InstanceState currentState = new InstanceState(); currentState.setCode(from.getShutdownStateCode()); currentState.setName(from.getShutdownState()); to.setCurrentState(currentState); return to; }
From source file:org.elasticsearch.discovery.ec2.AmazonEC2Mock.java
License:Apache License
public AmazonEC2Mock(int nodes, List<List<Tag>> tagsList) { if (tagsList != null) { assert tagsList.size() == nodes; }//from w ww. ja va 2 s . co m for (int node = 1; node < nodes + 1; node++) { String instanceId = "node" + node; Instance instance = new Instance().withInstanceId(instanceId) .withState(new InstanceState().withName(InstanceStateName.Running)) .withPrivateDnsName(PREFIX_PRIVATE_DNS + instanceId + SUFFIX_PRIVATE_DNS) .withPublicDnsName(PREFIX_PUBLIC_DNS + instanceId + SUFFIX_PUBLIC_DNS) .withPrivateIpAddress(PREFIX_PRIVATE_IP + node).withPublicIpAddress(PREFIX_PUBLIC_IP + node); if (tagsList != null) { instance.setTags(tagsList.get(node - 1)); } instances.add(instance); } }
From source file:org.jenkinsci.plugins.ec2harness.MockAmazonEC2.java
License:Open Source License
@Override public RunInstancesResult runInstances(RunInstancesRequest runInstancesRequest) throws AmazonServiceException, AmazonClientException { printcall();/* www . j ava 2 s. com*/ Instance instance = new Instance(); Random random = new Random(); instance.setInstanceId("" + random.nextInt(10000)); InstanceState instanceState = new InstanceState(); instanceState.setName(InstanceStateName.Running); instance.setState(instanceState); ArrayList<Instance> instances = new ArrayList<Instance>(); instances.add(instance); this.instances.add(instance); Reservation reservation = new Reservation(); reservation.setInstances(instances); RunInstancesResult runInstancesResult = new RunInstancesResult(); runInstancesResult.setReservation(reservation); return runInstancesResult; }