本文整理汇总了Java中com.amazonaws.services.ec2.model.ReleaseAddressRequest类的典型用法代码示例。如果您正苦于以下问题:Java ReleaseAddressRequest类的具体用法?Java ReleaseAddressRequest怎么用?Java ReleaseAddressRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReleaseAddressRequest类属于com.amazonaws.services.ec2.model包,在下文中一共展示了ReleaseAddressRequest类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import com.amazonaws.services.ec2.model.ReleaseAddressRequest; //导入依赖的package包/类
public static void main(String[] args)
{
final String USAGE =
"To run this example, supply an allocation ID.\n" +
"Ex: ReleaseAddress <allocation_id>\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String alloc_id = args[0];
final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
ReleaseAddressRequest request = new ReleaseAddressRequest()
.withAllocationId(alloc_id);
ReleaseAddressResult response = ec2.releaseAddress(request);
System.out.printf(
"Successfully released elastic IP address %s", alloc_id);
}
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:24,代码来源:ReleaseAddress.java
示例2: releaseReservedIp
import com.amazonaws.services.ec2.model.ReleaseAddressRequest; //导入依赖的package包/类
private void releaseReservedIp(AmazonEC2Client client, List<CloudResource> resources) {
CloudResource elasticIpResource = getReservedIp(resources);
if (elasticIpResource != null && elasticIpResource.getName() != null) {
Address address;
try {
DescribeAddressesResult describeResult = client.describeAddresses(
new DescribeAddressesRequest().withAllocationIds(elasticIpResource.getName()));
address = describeResult.getAddresses().get(0);
} catch (AmazonServiceException e) {
if (e.getErrorMessage().equals("The allocation ID '" + elasticIpResource.getName() + "' does not exist")) {
LOGGER.warn("Elastic IP with allocation ID '{}' not found. Ignoring IP release.", elasticIpResource.getName());
return;
} else {
throw e;
}
}
if (address.getAssociationId() != null) {
client.disassociateAddress(new DisassociateAddressRequest().withAssociationId(elasticIpResource.getName()));
}
client.releaseAddress(new ReleaseAddressRequest().withAllocationId(elasticIpResource.getName()));
}
}
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:23,代码来源:AwsResourceConnector.java
示例3: releaseElasticIPAddress
import com.amazonaws.services.ec2.model.ReleaseAddressRequest; //导入依赖的package包/类
/**
* Release an elastic IP address
*/
public DeferredResult<Void> releaseElasticIPAddress(String allocationId) {
ReleaseAddressRequest req = new ReleaseAddressRequest()
.withAllocationId(allocationId);
String message = "Release AWS Elastic IP Address with allocation id [" + allocationId
+ "].";
AWSDeferredResultAsyncHandler<ReleaseAddressRequest, ReleaseAddressResult> handler = new
AWSDeferredResultAsyncHandler<>(this.service, message);
this.client.releaseAddressAsync(req, handler);
return handler.toDeferredResult()
.thenApply(ignore -> null);
}
开发者ID:vmware,项目名称:photon-model,代码行数:17,代码来源:AWSNetworkClient.java
示例4: releaseEIP
import com.amazonaws.services.ec2.model.ReleaseAddressRequest; //导入依赖的package包/类
public void releaseEIP(List<String> instanceIds) {
logger.info("release EIP for instances, instanceIds={}", instanceIds);
DescribeAddressesResult result = ec2.describeAddresses(new DescribeAddressesRequest().withFilters(new Filter("instance-id").withValues(instanceIds)));
for (Address address : result.getAddresses()) {
logger.info("release EIP, ip={}, instanceId={}", address.getPublicIp(), address.getInstanceId());
ec2.disassociateAddress(new DisassociateAddressRequest().withAssociationId(address.getAssociationId()));
ec2.releaseAddress(new ReleaseAddressRequest().withAllocationId(address.getAllocationId()));
}
}
开发者ID:neowu,项目名称:cmn-project,代码行数:11,代码来源:EC2VPC.java
示例5: releaseAddress
import com.amazonaws.services.ec2.model.ReleaseAddressRequest; //导入依赖的package包/类
@Override
public void releaseAddress(ReleaseAddressRequest releaseAddressRequest) throws AmazonServiceException, AmazonClientException {
throw new UnsupportedOperationException("Not supported in mock");
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonEC2Mock.java
示例6: releaseAddress
import com.amazonaws.services.ec2.model.ReleaseAddressRequest; //导入依赖的package包/类
public static void releaseAddress(AmazonEC2 ec2, Address address) {
String allocationId = address.getAllocationId();
ReleaseAddressRequest releaseAddressRequest = new ReleaseAddressRequest();
releaseAddressRequest.setAllocationId(allocationId);
ec2.releaseAddress(releaseAddressRequest);
}
开发者ID:betahikaru,项目名称:ec2-util,代码行数:7,代码来源:AwsEc2Client.java
示例7: deleteAddress
import com.amazonaws.services.ec2.model.ReleaseAddressRequest; //导入依赖的package包/类
/**
* TODO: メソッドコメント
*
* @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);
}
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:50,代码来源:AwsAddressProcess.java
注:本文中的com.amazonaws.services.ec2.model.ReleaseAddressRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论