if (getMonitoring() != null) sb.append("Monitoring: ").append(getMonitoring()).append(","); if (getPlacement() != null) sb.append("Placement: ").append(getPlacement()).append(","); if (getPlatform() != null) sb.append("Platform: ").append(getPlatform()).append(",");
hashCode = prime * hashCode + ((getLaunchTime() == null) ? 0 : getLaunchTime().hashCode()); hashCode = prime * hashCode + ((getMonitoring() == null) ? 0 : getMonitoring().hashCode()); hashCode = prime * hashCode + ((getPlacement() == null) ? 0 : getPlacement().hashCode()); hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode()); hashCode = prime * hashCode + ((getPrivateDnsName() == null) ? 0 : getPrivateDnsName().hashCode());
if (other.getMonitoring() != null && other.getMonitoring().equals(this.getMonitoring()) == false) return false; if (other.getPlacement() == null ^ this.getPlacement() == null) return false; if (other.getPlacement() != null && other.getPlacement().equals(this.getPlacement()) == false) return false; if (other.getPlatform() == null ^ this.getPlatform() == null)
if (getInstanceType() != null) sb.append("InstanceType: " + getInstanceType() + ","); if (getLaunchTime() != null) sb.append("LaunchTime: " + getLaunchTime() + ","); if (getPlacement() != null) sb.append("Placement: " + getPlacement() + ","); if (getKernelId() != null) sb.append("KernelId: " + getKernelId() + ","); if (getRamdiskId() != null) sb.append("RamdiskId: " + getRamdiskId() + ",");
hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode()); hashCode = prime * hashCode + ((getLaunchTime() == null) ? 0 : getLaunchTime().hashCode()); hashCode = prime * hashCode + ((getPlacement() == null) ? 0 : getPlacement().hashCode()); hashCode = prime * hashCode + ((getKernelId() == null) ? 0 : getKernelId().hashCode()); hashCode = prime * hashCode + ((getRamdiskId() == null) ? 0 : getRamdiskId().hashCode());
if (other.getLaunchTime() == null ^ this.getLaunchTime() == null) return false; if (other.getLaunchTime() != null && other.getLaunchTime().equals(this.getLaunchTime()) == false) return false; if (other.getPlacement() == null ^ this.getPlacement() == null) return false; if (other.getPlacement() != null && other.getPlacement().equals(this.getPlacement()) == false) return false; if (other.getKernelId() == null ^ this.getKernelId() == null) return false; if (other.getKernelId() != null && other.getKernelId().equals(this.getKernelId()) == false) return false;
public static String getLocation(com.amazonaws.services.ec2.model.Instance instance, String role) { String zone = instance.getPlacement().getAvailabilityZone(); String region = zone.substring(0, zone.length() - 1); return Joiner.on('/').join("", "ec2", region, zone, instance.getInstanceId(), role); }
/** * Returns the region (for example, {@code eu-west-1}) that the * {@link Instance} was launched in by looking at the availability zone. * * @param instance * @return */ private String extractRegion(Instance instance) { if (instance.getPlacement() == null || instance.getPlacement().getAvailabilityZone() == null) { LOG.warn("failed to extract region for {}: " + "no placement/availability zone information available", instance.getInstanceId()); return "unknown"; } // availability zone is region + letter, for instance 'eu-west-1a' String availabilityZone = instance.getPlacement().getAvailabilityZone(); String region = availabilityZone.substring(0, availabilityZone.length() - 1); return region; }
public static String getLocation(com.amazonaws.services.ec2.model.Instance instance, String role) { String zone = instance.getPlacement().getAvailabilityZone(); String region = zone.substring(0, zone.length() - 1); return Joiner.on('/').join("", "ec2", region, zone, instance.getInstanceId(), role); }
protected HashMap getAwsInstanceProperties(Instance awsInstance) throws Exception { HashMap map = mapper.readValue(mapper.writeValueAsString(awsInstance), HashMap.class); if (awsInstance.getMonitoring() != null && awsInstance.getMonitoring().getState() != null) { //Have to comply with the current AWS_V1 schema map.put("monitoring", awsInstance.getMonitoring().getState().toString()); } if (awsInstance.getPlacement() != null && awsInstance.getPlacement().getAvailabilityZone() != null) { //Be backward compatible for tools Map placement = (Map) map.get("placement"); if (placement != null) { placement.put("availability_zone", awsInstance.getPlacement().getAvailabilityZone()); } } return map; } }
if (getMonitoring() != null) sb.append("Monitoring: ").append(getMonitoring()).append(","); if (getPlacement() != null) sb.append("Placement: ").append(getPlacement()).append(","); if (getPlatform() != null) sb.append("Platform: ").append(getPlatform()).append(",");
@Override public EsInstance createFromEC2(Instance awsInstance) throws Exception { Preconditions.checkNotNull(awsInstance); EsInstance esInstance = new EsInstance(); esInstance.setId(awsInstance.getInstanceId()); esInstance.setState(awsInstance.getState().getName()); esInstance.setLocation(awsInstance.getPlacement().getAvailabilityZone()); //Region=location-last char. This is what CMDBV1 and people on internet do. //There should be a better way. Right now, keep as what it is esInstance.setRegion( esInstance.getLocation().substring(0, esInstance.getLocation().length() - 1)); esInstance.setAwsLaunchTime(awsInstance.getLaunchTime()); esInstance.setSubnetId(awsInstance.getSubnetId()); esInstance.setVpcId(awsInstance.getVpcId()); //Convert AWS instance to a map of property bags and save it. esInstance.getCloud() .put("aws", getAwsInstanceProperties(awsInstance)); Date utcNow = DateTime.now(DateTimeZone.UTC).toDate(); esInstance.setCreatedTime(utcNow); esInstance.setUpdatedTime(utcNow); return esInstance; } }
hashCode = prime * hashCode + ((getLaunchTime() == null) ? 0 : getLaunchTime().hashCode()); hashCode = prime * hashCode + ((getMonitoring() == null) ? 0 : getMonitoring().hashCode()); hashCode = prime * hashCode + ((getPlacement() == null) ? 0 : getPlacement().hashCode()); hashCode = prime * hashCode + ((getPlatform() == null) ? 0 : getPlatform().hashCode()); hashCode = prime * hashCode + ((getPrivateDnsName() == null) ? 0 : getPrivateDnsName().hashCode());
this.lifecycle = instance.getInstanceLifecycle(); this.hypervisor = instance.getHypervisor(); this.az = instance.getPlacement().getAvailabilityZone(); this.group = instance.getPlacement().getGroupName(); this.tenancy = instance.getPlacement().getTenancy(); this.vpc = instance.getVpcId(); this.platform = instance.getPlatform();
/** * @see org.apache.airavata.xbaya.ui.widgets.TableRenderable#getValue(int) */ @Override public Object getValue(int index) { switch (index) { case 0: return this.instance.getInstanceId(); case 1: return this.instance.getImageId(); case 2: return this.instance.getRootDeviceType(); case 3: return this.instance.getInstanceType(); case 4: return this.instance.getState().getName(); case 5: return this.instance.getKeyName(); case 6: return this.instance.getMonitoring().getState(); case 7: return this.instance.getVirtualizationType(); case 8: return this.instance.getPlacement().getGroupName(); default: return null; } }
if (other.getMonitoring() != null && other.getMonitoring().equals(this.getMonitoring()) == false) return false; if (other.getPlacement() == null ^ this.getPlacement() == null) return false; if (other.getPlacement() != null && other.getPlacement().equals(this.getPlacement()) == false) return false; if (other.getPlatform() == null ^ this.getPlatform() == null)