public boolean alreadyBound() throws MalformedURLException { InstanceInfo myInfo = applicationInfoManager.getInfo(); String myInstanceId = ((AmazonInfo) myInfo.getDataCenterInfo()).get(AmazonInfo.MetaDataKey.instanceId); AmazonEC2 ec2Service = getEC2Service(); List<InstanceNetworkInterface> instanceNetworkInterfaces = instanceData(myInstanceId, ec2Service).getNetworkInterfaces(); List<String> candidateIPs = getCandidateIps(); for (String ip : candidateIPs) { for(InstanceNetworkInterface ini: instanceNetworkInterfaces) { if (ip.equals(ini.getPrivateIpAddress())) { logger.info("My instance {} seems to be already associated with the ip {}", myInstanceId, ip); return true; } } } return false; }
if (getElasticInferenceAcceleratorAssociations() != null) sb.append("ElasticInferenceAcceleratorAssociations: ").append(getElasticInferenceAcceleratorAssociations()).append(","); if (getNetworkInterfaces() != null) sb.append("NetworkInterfaces: ").append(getNetworkInterfaces()).append(","); if (getRootDeviceName() != null) sb.append("RootDeviceName: ").append(getRootDeviceName()).append(",");
/** * Unbind the IP that this instance is associated with. */ public void unbind() throws Exception { InstanceInfo myInfo = applicationInfoManager.getInfo(); String myInstanceId = ((AmazonInfo) myInfo.getDataCenterInfo()).get(AmazonInfo.MetaDataKey.instanceId); AmazonEC2 ec2 = getEC2Service(); List<InstanceNetworkInterface> result = instanceData(myInstanceId, ec2).getNetworkInterfaces(); List<String> ips = getCandidateIps(); for(InstanceNetworkInterface networkInterface: result){ if (ips.contains(networkInterface.getPrivateIpAddress())) { String attachmentId = networkInterface.getAttachment().getAttachmentId(); ec2.detachNetworkInterface(new DetachNetworkInterfaceRequest().withAttachmentId(attachmentId)); break; } } }
hashCode = prime * hashCode + ((getElasticGpuAssociations() == null) ? 0 : getElasticGpuAssociations().hashCode()); hashCode = prime * hashCode + ((getElasticInferenceAcceleratorAssociations() == null) ? 0 : getElasticInferenceAcceleratorAssociations().hashCode()); hashCode = prime * hashCode + ((getNetworkInterfaces() == null) ? 0 : getNetworkInterfaces().hashCode()); hashCode = prime * hashCode + ((getRootDeviceName() == null) ? 0 : getRootDeviceName().hashCode()); hashCode = prime * hashCode + ((getRootDeviceType() == null) ? 0 : getRootDeviceType().hashCode());
/** * [EC2-VPC] One or more network interfaces for the instance. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param networkInterfaces [EC2-VPC] One or more network interfaces for the instance. * * @return A reference to this updated object so that method calls can be chained * together. */ public Instance withNetworkInterfaces(InstanceNetworkInterface... networkInterfaces) { if (getNetworkInterfaces() == null) setNetworkInterfaces(new java.util.ArrayList<InstanceNetworkInterface>(networkInterfaces.length)); for (InstanceNetworkInterface value : networkInterfaces) { getNetworkInterfaces().add(value); } return this; }
&& other.getElasticInferenceAcceleratorAssociations().equals(this.getElasticInferenceAcceleratorAssociations()) == false) return false; if (other.getNetworkInterfaces() == null ^ this.getNetworkInterfaces() == null) return false; if (other.getNetworkInterfaces() != null && other.getNetworkInterfaces().equals(this.getNetworkInterfaces()) == false) return false; if (other.getRootDeviceName() == null ^ this.getRootDeviceName() == null)
if (isSourceDestCheck() != null) sb.append("SourceDestCheck: " + isSourceDestCheck() + ","); if (getHypervisor() != null) sb.append("Hypervisor: " + getHypervisor() + ","); if (getNetworkInterfaces() != null) sb.append("NetworkInterfaces: " + getNetworkInterfaces() + ","); if (getIamInstanceProfile() != null) sb.append("IamInstanceProfile: " + getIamInstanceProfile() + ","); if (isEbsOptimized() != null) sb.append("EbsOptimized: " + isEbsOptimized() + ",");
hashCode = prime * hashCode + ((isSourceDestCheck() == null) ? 0 : isSourceDestCheck().hashCode()); hashCode = prime * hashCode + ((getHypervisor() == null) ? 0 : getHypervisor().hashCode()); hashCode = prime * hashCode + ((getNetworkInterfaces() == null) ? 0 : getNetworkInterfaces().hashCode()); hashCode = prime * hashCode + ((getIamInstanceProfile() == null) ? 0 : getIamInstanceProfile().hashCode()); hashCode = prime * hashCode + ((isEbsOptimized() == null) ? 0 : isEbsOptimized().hashCode());
if (other.getHypervisor() == null ^ this.getHypervisor() == null) return false; if (other.getHypervisor() != null && other.getHypervisor().equals(this.getHypervisor()) == false) return false; if (other.getNetworkInterfaces() == null ^ this.getNetworkInterfaces() == null) return false; if (other.getNetworkInterfaces() != null && other.getNetworkInterfaces().equals(this.getNetworkInterfaces()) == false) return false; if (other.getIamInstanceProfile() == null ^ this.getIamInstanceProfile() == null) return false; if (other.getIamInstanceProfile() != null && other.getIamInstanceProfile().equals(this.getIamInstanceProfile()) == false) return false;
public boolean alreadyBound() throws MalformedURLException { InstanceInfo myInfo = applicationInfoManager.getInfo(); String myInstanceId = ((AmazonInfo) myInfo.getDataCenterInfo()).get(AmazonInfo.MetaDataKey.instanceId); AmazonEC2 ec2Service = getEC2Service(); List<InstanceNetworkInterface> instanceNetworkInterfaces = instanceData(myInstanceId, ec2Service).getNetworkInterfaces(); List<String> candidateIPs = getCandidateIps(); for (String ip : candidateIPs) { for(InstanceNetworkInterface ini: instanceNetworkInterfaces) { if (ip.equals(ini.getPrivateIpAddress())) { logger.info("My instance {} seems to be already associated with the ip {}", myInstanceId, ip); return true; } } } return false; }
if (getElasticInferenceAcceleratorAssociations() != null) sb.append("ElasticInferenceAcceleratorAssociations: ").append(getElasticInferenceAcceleratorAssociations()).append(","); if (getNetworkInterfaces() != null) sb.append("NetworkInterfaces: ").append(getNetworkInterfaces()).append(","); if (getRootDeviceName() != null) sb.append("RootDeviceName: ").append(getRootDeviceName()).append(",");
instance.getNetworkInterfaces().add(InstanceNetworkInterfaceStaxUnmarshaller.getInstance().unmarshall(context)); continue;
hashCode = prime * hashCode + ((getElasticGpuAssociations() == null) ? 0 : getElasticGpuAssociations().hashCode()); hashCode = prime * hashCode + ((getElasticInferenceAcceleratorAssociations() == null) ? 0 : getElasticInferenceAcceleratorAssociations().hashCode()); hashCode = prime * hashCode + ((getNetworkInterfaces() == null) ? 0 : getNetworkInterfaces().hashCode()); hashCode = prime * hashCode + ((getRootDeviceName() == null) ? 0 : getRootDeviceName().hashCode()); hashCode = prime * hashCode + ((getRootDeviceType() == null) ? 0 : getRootDeviceType().hashCode());
/** * Unbind the IP that this instance is associated with. */ public void unbind() throws Exception { InstanceInfo myInfo = applicationInfoManager.getInfo(); String myInstanceId = ((AmazonInfo) myInfo.getDataCenterInfo()).get(AmazonInfo.MetaDataKey.instanceId); AmazonEC2 ec2 = getEC2Service(); List<InstanceNetworkInterface> result = instanceData(myInstanceId, ec2).getNetworkInterfaces(); List<String> ips = getCandidateIps(); for(InstanceNetworkInterface networkInterface: result){ if (ips.contains(networkInterface.getPrivateIpAddress())) { String attachmentId = networkInterface.getAttachment().getAttachmentId(); ec2.detachNetworkInterface(new DetachNetworkInterfaceRequest().withAttachmentId(attachmentId)); break; } } }
&& other.getElasticInferenceAcceleratorAssociations().equals(this.getElasticInferenceAcceleratorAssociations()) == false) return false; if (other.getNetworkInterfaces() == null ^ this.getNetworkInterfaces() == null) return false; if (other.getNetworkInterfaces() != null && other.getNetworkInterfaces().equals(this.getNetworkInterfaces()) == false) return false; if (other.getRootDeviceName() == null ^ this.getRootDeviceName() == null)