List of usage examples for com.amazonaws.services.ec2.model InternetGateway getAttachments
public java.util.List<InternetGatewayAttachment> getAttachments()
Any VPCs attached to the internet gateway.
From source file:com.urbancode.terraform.tasks.aws.InetGwyTask.java
License:Apache License
public boolean verify() { // will return false if the id is null boolean result = false; if (gatewayId != null) { if (ec2Client == null) { ec2Client = context.fetchEC2Client(); }/*from ww w. ja v a 2 s . co m*/ List<String> id = new ArrayList<String>(); id.add(gatewayId); List<InternetGateway> gateways = helper.getInternetGateways(id, ec2Client); if (gateways != null && !gateways.isEmpty()) { for (InternetGateway gateway : gateways) { List<InternetGatewayAttachment> attachments = gateway.getAttachments(); if (attachments != null && !attachments.isEmpty()) { for (InternetGatewayAttachment attachment : attachments) { String attachedVpc = attachment.getVpcId(); if (vpcId.equals(attachedVpc)) { result = true; } } } } } } return result; }