List of usage examples for com.amazonaws.services.ec2.model Instance getProductCodes
public java.util.List<ProductCode> getProductCodes()
The product codes attached to this instance, if applicable.
From source file:com.clouck.model.aws.ec2.Ec2Instance.java
@Override @SuppressWarnings("rawtypes") protected boolean isEqual(AbstractResource newResource) { Instance oldInstance = this.getResource(); Ec2Instance newEc2Instance = (Ec2Instance) newResource; Instance newInstance = newEc2Instance.getResource(); if (notEqual(oldInstance.getInstanceId(), newInstance.getInstanceId())) return false; if (notEqual(oldInstance.getImageId(), newInstance.getImageId())) return false; if (notEqual(oldInstance.getState(), newInstance.getState())) return false; if (notEqual(oldInstance.getPrivateDnsName(), newInstance.getPrivateDnsName())) return false; if (notEqual(oldInstance.getPublicDnsName(), newInstance.getPublicDnsName())) return false; if (notEqual(oldInstance.getStateTransitionReason(), newInstance.getStateTransitionReason())) return false; if (notEqual(oldInstance.getKeyName(), newInstance.getKeyName())) return false; if (notEqual(oldInstance.getAmiLaunchIndex(), newInstance.getAmiLaunchIndex())) return false; if (notEqualCollection(oldInstance.getProductCodes(), newInstance.getProductCodes())) return false; if (notEqual(oldInstance.getInstanceType(), newInstance.getInstanceType())) return false; if (notEqual(oldInstance.getLaunchTime(), newInstance.getLaunchTime())) return false; if (notEqual(oldInstance.getPlacement(), newInstance.getPlacement())) return false; if (notEqual(oldInstance.getKernelId(), newInstance.getKernelId())) return false; if (notEqual(oldInstance.getRamdiskId(), newInstance.getRamdiskId())) return false; if (notEqual(oldInstance.getPlatform(), newInstance.getPlatform())) return false; if (notEqual(oldInstance.getMonitoring(), newInstance.getMonitoring())) return false; if (notEqual(oldInstance.getSubnetId(), newInstance.getSubnetId())) return false; if (notEqual(oldInstance.getVpcId(), newInstance.getVpcId())) return false; if (notEqual(oldInstance.getPrivateIpAddress(), newInstance.getPrivateIpAddress())) return false; if (notEqual(oldInstance.getPublicIpAddress(), newInstance.getPublicIpAddress())) return false; if (notEqual(oldInstance.getStateReason(), newInstance.getStateReason())) return false; if (notEqual(oldInstance.getArchitecture(), newInstance.getArchitecture())) return false; if (notEqual(oldInstance.getRootDeviceType(), newInstance.getRootDeviceType())) return false; if (notEqual(oldInstance.getRootDeviceName(), newInstance.getRootDeviceName())) return false; if (notEqualCollection(oldInstance.getBlockDeviceMappings(), newInstance.getBlockDeviceMappings())) return false; if (notEqual(oldInstance.getVirtualizationType(), newInstance.getVirtualizationType())) return false; if (notEqual(oldInstance.getInstanceLifecycle(), newInstance.getInstanceLifecycle())) return false; if (notEqual(oldInstance.getSpotInstanceRequestId(), newInstance.getSpotInstanceRequestId())) return false; if (notEqual(oldInstance.getLicense(), newInstance.getLicense())) return false; if (notEqual(oldInstance.getClientToken(), newInstance.getClientToken())) return false; if (notEqualCollection(oldInstance.getTags(), newInstance.getTags())) return false; if (notEqualCollection(oldInstance.getSecurityGroups(), newInstance.getSecurityGroups())) return false; if (notEqual(oldInstance.getSourceDestCheck(), newInstance.getSourceDestCheck())) return false; if (notEqual(oldInstance.getHypervisor(), newInstance.getHypervisor())) return false; if (notEqualNetworkInterfaces(oldInstance.getNetworkInterfaces(), newInstance.getNetworkInterfaces())) return false; if (notEqual(oldInstance.getIamInstanceProfile(), newInstance.getIamInstanceProfile())) return false; if (notEqual(oldInstance.getEbsOptimized(), newInstance.getEbsOptimized())) return false; if (notEqual(this.getTerminationProtection(), newEc2Instance.getTerminationProtection())) return false; if (notEqual(this.getShutdownBehavior(), newEc2Instance.getShutdownBehavior())) return false; if (notEqual(this.getUserData(), newEc2Instance.getUserData())) return false; return true;/*from w ww. j a va2 s .co m*/ }
From source file:org.gridgain.grid.spi.cloud.ec2lite.GridEc2LiteCloudSpi.java
License:GNU General Public License
/** * Gets instance resource from EC2 instance. * * @param inst EC2 instance./*w w w. j a va 2s. co m*/ * @return Instance resource. */ private GridCloudSpiResourceAdapter createInstanceResource(Instance inst) { assert inst != null; Map<String, String> params = new HashMap<String, String>(); params.put(INST_STATE_TRANS_REASON, inst.getStateTransitionReason()); params.put(INST_KEY_PAIR_NAME, inst.getKeyName()); params.put(INST_AMI_LAUNCH_IDX, String.valueOf(inst.getAmiLaunchIndex())); params.put(INST_LAUNCH_TIME, String.valueOf(inst.getLaunchTime())); params.put(INST_TYPE, inst.getInstanceType()); params.put(INST_STATE, inst.getState().getName()); params.put(INST_STATE_CODE, String.valueOf(inst.getState().getCode())); params.put(IMG_KERNEL_ID, inst.getKernelId()); params.put(IMG_RAMDISK_ID, inst.getRamdiskId()); params.put(INST_MON_STATE, inst.getMonitoring().getState()); params.put(INST_PLACEMENT, inst.getPlacement().getAvailabilityZone()); params.put(INST_PLATFORM, inst.getPlatform()); params.put(INST_PRIV_DNS, inst.getPrivateDnsName()); params.put(INST_PUB_DNS, inst.getPublicDnsName()); params.put(PRODUCT_CODE_IDS, F.concat(F.transform(inst.getProductCodes(), new C1<ProductCode, String>() { @Override public String apply(ProductCode e) { return e.getProductCodeId(); } }), VAL_DELIM)); return new GridCloudSpiResourceAdapter(inst.getInstanceId(), CLD_INSTANCE, cloudId, params); }
From source file:org.occiware.clouddriver.util.InstanceDataFactory.java
License:Apache License
public static InstanceDO buildInstanceDataFromModel(Instance instance) { InstanceDO instanceDO = new InstanceDO(); buildBasicInstanceData(instance, instanceDO); Placement placement = instance.getPlacement(); if (placement != null) { PlacementDO placementDO = buildPlacementDO(instanceDO, placement); instanceDO.setPlacement(placementDO); }//from ww w . j ava2s . c o m // Ebs volumes attached on instance. if (instance.getBlockDeviceMappings() != null && !instance.getBlockDeviceMappings().isEmpty()) { List<InstanceVolumeDO> instanceVolumeDOs = BuildInstanceVolumeDOs(instance); instanceDO.setVolumes(instanceVolumeDOs); } if (instance.getIamInstanceProfile() != null) { IamInstanceProfileDO profileDO = buildIamInstanceProfileDO(instance); instanceDO.setIamInstanceProfile(profileDO); } if (instance.getMonitoring() != null) { Monitoring monitoring = instance.getMonitoring(); instanceDO.setMonitoringState(monitoring.getState()); } // Network part. if (instance.getNetworkInterfaces() != null && !instance.getNetworkInterfaces().isEmpty()) { List<NetworkInterfaceDO> networkInterfaceDOs = buildNetworkInterfacesDatas(instance); instanceDO.setNetworkAdapters(networkInterfaceDOs); } List<ProductCode> productCodes = instance.getProductCodes(); if (productCodes != null && !productCodes.isEmpty()) { List<ProductCodeDO> productCodeDOs = buildProductCodesDatas(productCodes); instanceDO.setProductCodes(productCodeDOs); } List<GroupIdentifier> groups = instance.getSecurityGroups(); if (groups != null && !groups.isEmpty()) { List<GroupIdentifierDO> groupIdentifierDOs = buildSecurityGroupsDatas(groups); instanceDO.setSecurityGroups(groupIdentifierDOs); } InstanceState state = instance.getState(); if (state != null) { instanceDO.setInstanceState(state.getName()); instanceDO.setInstanceStateCode(state.getCode()); StateReason stateReason = instance.getStateReason(); if (stateReason != null) { instanceDO.setInstanceStateReasonMessage(stateReason.getMessage()); instanceDO.setInstanceStateReasonCode(stateReason.getCode()); } } List<Tag> tags = instance.getTags(); if (tags != null && !tags.isEmpty()) { List<TagDO> tagDOs = buildTagsDatas(tags); instanceDO.setTags(tagDOs); } return instanceDO; }
From source file:org.xmlsh.aws.util.AWSEC2Command.java
License:BSD License
protected void writeReservation(Reservation res) throws XMLStreamException { startElement("reservation"); attribute("id", res.getReservationId()); attribute("requester-id", res.getRequesterId()); for (Instance inst : res.getInstances()) { startElement("instance"); attribute("instance-id", inst.getInstanceId()); attribute("image", inst.getImageId()); attribute("key-name", inst.getKeyName()); attribute("architecture", inst.getArchitecture()); attribute("client-token", inst.getClientToken()); attribute("lifecycle", Util.notNull(inst.getInstanceLifecycle())); attribute("instance-type", inst.getInstanceType()); attribute("kernel-id", inst.getKernelId()); attribute("platform", inst.getPlatform()); attribute("private-dns", inst.getPrivateDnsName()); attribute("private-ip", inst.getPrivateIpAddress()); attribute("public-dns", inst.getPublicDnsName()); attribute("public-ip", inst.getPublicIpAddress()); attribute("ramdisk-id", inst.getRamdiskId()); attribute("root-device-name", inst.getRootDeviceName()); attribute("spot-request-id", inst.getSpotInstanceRequestId()); attribute("state-transistion-reason", inst.getStateTransitionReason()); attribute("subnet-id", inst.getSubnetId()); attribute("state", inst.getState().getName()); attribute("virtualization-type", inst.getVirtualizationType()); attribute("vpcid", inst.getVpcId()); attribute("ami-launch-index", inst.getAmiLaunchIndex().toString()); attribute("launch-date", Util.formatXSDateTime(inst.getLaunchTime())); attribute("monitoring", inst.getMonitoring().getState()); attribute("source-dest-check", getSourceCheck(inst)); attribute("state-reason", getStateReason(inst)); writeProductCodes(inst.getProductCodes()); writeTags(inst.getTags());// w w w . j a v a2s . c om writePlacement(inst.getPlacement()); writeInstanceBlockDeviceMappings(inst.getBlockDeviceMappings()); endElement(); } endElement(); }