List of usage examples for com.amazonaws.services.ec2.model Subnet getTags
public java.util.List<Tag> getTags()
Any tags assigned to the subnet.
From source file:com.infinitechaos.vpcviewer.web.rest.dto.SubnetDTO.java
License:Open Source License
public SubnetDTO(final Subnet subnet) { this.subnetId = subnet.getSubnetId(); this.vpcId = subnet.getVpcId(); this.state = subnet.getState(); this.availabilityZone = subnet.getAvailabilityZone(); this.cidrBlock = subnet.getCidrBlock(); this.tags.addAll(subnet.getTags().stream().map(TagDTO::new).collect(Collectors.toList())); this.name = subnet.getTags().stream().filter(t -> t.getKey().equals("Name")).findFirst().map(Tag::getValue) .orElse("n/a"); }
From source file:com.pinterest.arcee.handler.SpecsHandler.java
License:Apache License
public List<SpecBean> getSubnets() { DescribeSubnetsRequest request = new DescribeSubnetsRequest(); request.setFilters(/*w w w . ja v a2 s. c o m*/ Arrays.asList(new Filter[] { new Filter("VpcId", Arrays.asList(new String[] { VPC_ID })) })); DescribeSubnetsResult result = client.describeSubnets(); List<Subnet> subnets = result.getSubnets(); ArrayList<SpecBean> subnetsName = new ArrayList<>(); for (Subnet subnet : subnets) { SpecBean specBean = new SpecBean(); specBean.setSpecId(subnet.getSubnetId()); specBean.addInfo("zone", subnet.getAvailabilityZone()); if (subnet.getTags().isEmpty()) { specBean.addInfo("tag", ""); } else { specBean.addInfo("tag", subnet.getTags().get(0).getValue()); } subnetsName.add(specBean); } return subnetsName; }