/** * Delete a route table */ public DeferredResult<Void> deleteRouteTable(String routeTableId) { DeleteRouteTableRequest req = new DeleteRouteTableRequest() .withRouteTableId(routeTableId); String message = "Delete AWS Route Table with id [" + routeTableId + "]."; AWSDeferredResultAsyncHandler<DeleteRouteTableRequest, DeleteRouteTableResult> handler = new AWSDeferredResultAsyncHandler<>(this.service, message); this.client.deleteRouteTableAsync(req, handler); return handler.toDeferredResult() .thenApply(ignore -> null); }
@Override public void execute(Context context) throws Exception { logger.info("delete route table, routeTableId={}", resource.id); for (RouteTableAssociation association : resource.remoteRouteTable.getAssociations()) { AWS.vpc.ec2.disassociateRouteTable(new DisassociateRouteTableRequest().withAssociationId(association.getRouteTableAssociationId())); } AWS.vpc.ec2.deleteRouteTable(new DeleteRouteTableRequest().withRouteTableId(resource.remoteRouteTable.getRouteTableId())); }
/** * Delete route table. * * @param routeTableId the route table id * @return true if deleted */ protected final boolean deleteRouteTable(final String routeTableId) { DeleteRouteTableRequest req = new DeleteRouteTableRequest(); req.setRouteTableId(routeTableId); DeleteRouteTableResult result = amazonEC2Client.deleteRouteTable(req); if (result != null) { return true; } return false; }
@Override public void deleteRouteTable(DeleteRouteTableRequest deleteRouteTableRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }