@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; }); }
@Override public void detachInternetGateway(DetachInternetGatewayRequest detachInternetGatewayRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }
public void detachInternetGateway(String vpcId, String gatewayId) { DetachInternetGatewayRequest req = new DetachInternetGatewayRequest() .withVpcId(vpcId) .withInternetGatewayId(gatewayId); this.client.detachInternetGateway(req); }
/** * Detach an Internet Gateway to a VPC. */ public static void detachInternetGateway(AmazonEC2AsyncClient client, String vpcId, String internetGatewayId) { client.detachInternetGateway(new DetachInternetGatewayRequest() .withVpcId(vpcId) .withInternetGatewayId(internetGatewayId)); }
@Override public void detachInternetGateway(DetachInternetGatewayRequest request) { detachInternetGateway(request, null); }
@Override public void detachInternetGateway(DetachInternetGatewayRequest request, ResultCapture<Void> extractor) { resource.performAction("DetachInternetGateway", request, extractor); }
@Override public void detachFromVpc(DetachInternetGatewayRequest request) { detachFromVpc(request, null); }
@Override public void detachFromVpc(DetachInternetGatewayRequest request, ResultCapture<Void> extractor) { resource.performAction("DetachFromVpc", request, extractor); }
/** * Performs the <code>DetachInternetGateway</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>Vpc</code> resource, and any conflicting parameter value set in the * request will be overridden: * <ul> * <li> * <b><code>VpcId</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @see DetachInternetGatewayRequest */ void detachInternetGateway(DetachInternetGatewayRequest request);
/** * Performs the <code>DetachInternetGateway</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>Vpc</code> resource, and any conflicting parameter value set in the * request will be overridden: * <ul> * <li> * <b><code>VpcId</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @see DetachInternetGatewayRequest */ void detachInternetGateway(DetachInternetGatewayRequest request, ResultCapture<Void> extractor);
/** * Performs the <code>DetachFromVpc</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 DetachInternetGatewayRequest */ void detachFromVpc(DetachInternetGatewayRequest request);
/** * Performs the <code>DetachFromVpc</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 DetachInternetGatewayRequest */ void detachFromVpc(DetachInternetGatewayRequest request, ResultCapture<Void> extractor);