List of usage examples for com.amazonaws.services.ec2.model ReleaseAddressRequest withPublicIp
public ReleaseAddressRequest withPublicIp(String publicIp)
[EC2-Classic] The Elastic IP address.
From source file:jp.primecloud.auto.process.aws.AwsAddressProcess.java
License:Open Source License
/** * TODO: // w w w . j av a2 s .c o m * * @param awsProcessClient * @param addressNo */ public void deleteAddress(AwsProcessClient awsProcessClient, Long addressNo) { // AWS?? AwsAddress awsAddress = awsAddressDao.read(addressNo); if (awsAddress == null) { return; } // Elastic IP?? if (StringUtils.isEmpty(awsAddress.getPublicIp())) { // Elastic IP??AWS?? awsAddressDao.delete(awsAddress); return; } // Elastic IP try { ReleaseAddressRequest request = new ReleaseAddressRequest(); // VPC?? if (BooleanUtils.isTrue(awsProcessClient.getPlatformAws().getVpc())) { // ?ID?? Address address = awsCommonProcess.describeAddress(awsProcessClient, awsAddress.getPublicIp()); request.withAllocationId(address.getAllocationId()); } // ?VPC?? else { request.withPublicIp(awsAddress.getPublicIp()); } awsProcessClient.getEc2Client().releaseAddress(request); // processLogger.debug(null, null, "AwsElasticIpRelease", new Object[] { awsProcessClient.getPlatform().getPlatformName(), awsAddress.getPublicIp() }); } catch (Exception ignore) { // Elastic IP??????????????????? log.warn(ignore.getMessage()); } // AWS awsAddressDao.delete(awsAddress); }