Search in sources :

Example 1 with ReleaseAddressResult

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);
}
Also used : ReleaseAddressResult(com.amazonaws.services.ec2.model.ReleaseAddressResult) ReleaseAddressRequest(com.amazonaws.services.ec2.model.ReleaseAddressRequest)

Example 2 with ReleaseAddressResult

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);
}
Also used : ReleaseAddressResult(com.amazonaws.services.ec2.model.ReleaseAddressResult) AmazonEC2(com.amazonaws.services.ec2.AmazonEC2) ReleaseAddressRequest(com.amazonaws.services.ec2.model.ReleaseAddressRequest)

Aggregations

ReleaseAddressRequest (com.amazonaws.services.ec2.model.ReleaseAddressRequest)2 ReleaseAddressResult (com.amazonaws.services.ec2.model.ReleaseAddressResult)2 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)1