use of com.amazonaws.services.ec2.model.ReleaseAddressResult in project photon-model by vmware.
the class AWSNetworkClient method releaseElasticIPAddress.
/**
* 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);
}
use of com.amazonaws.services.ec2.model.ReleaseAddressResult in project aws-doc-sdk-examples by awsdocs.
the class ReleaseAddress method main.
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);
}
Aggregations