@Override public void execute(Context context) throws Exception { new Runner<Void>() .maxAttempts(5) .retryInterval(Duration.ofSeconds(60)) .retryOn(e -> e instanceof AmazonServiceException) .run(() -> { logger.info("delete internet gateway, internetGatewayId={}", resource.id); AWS.vpc.ec2.detachInternetGateway(new DetachInternetGatewayRequest() .withVpcId(resource.vpc.remoteVPC.getVpcId()) .withInternetGatewayId(resource.remoteInternetGatewayId)); AWS.vpc.ec2.deleteInternetGateway(new DeleteInternetGatewayRequest() .withInternetGatewayId(resource.remoteInternetGatewayId)); return null; }); }
/** * Delete internet gateway. * * @param internetGatewayId the internet gateway id * @return true if deleted */ protected final boolean deleteInternetGateway(final String internetGatewayId) { DeleteInternetGatewayRequest req = new DeleteInternetGatewayRequest(); req.setInternetGatewayId(internetGatewayId); DeleteInternetGatewayResult result = amazonEC2Client.deleteInternetGateway(req); if (result != null) { return true; } return false; }
@Override public void deleteInternetGateway(DeleteInternetGatewayRequest deleteInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }
public void deleteInternetGateway(String resourceID) { DeleteInternetGatewayRequest req = new DeleteInternetGatewayRequest() .withInternetGatewayId(resourceID); this.client.deleteInternetGateway(req); }
/** * Delete an Internet Gateway. */ public static void deleteInternetGateway(AmazonEC2AsyncClient client, String internetGatewayId) { client.deleteInternetGateway(new DeleteInternetGatewayRequest().withInternetGatewayId(internetGatewayId)); }
@Override public void delete(DeleteInternetGatewayRequest request) { delete(request, null); }
@Override public void delete(DeleteInternetGatewayRequest request, ResultCapture<Void> extractor) { resource.performAction("Delete", request, extractor); }
/** * Performs the <code>Delete</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>InternetGateway</code> resource, and any conflicting parameter * value set in the request will be overridden: * <ul> * <li> * <b><code>InternetGatewayId</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @see DeleteInternetGatewayRequest */ void delete(DeleteInternetGatewayRequest request);
/** * Performs the <code>Delete</code> action and use a ResultCapture to * retrieve the low-level client response. * * <p> * The following request parameters will be populated from the data of this * <code>InternetGateway</code> resource, and any conflicting parameter * value set in the request will be overridden: * <ul> * <li> * <b><code>InternetGatewayId</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @see DeleteInternetGatewayRequest */ void delete(DeleteInternetGatewayRequest request, ResultCapture<Void> extractor);