List of usage examples for com.amazonaws.services.ec2.model Subnet getVpcId
public String getVpcId()
The ID of the VPC the subnet is in.
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:de.unibi.cebitec.bibigrid.meta.aws.CreateClusterEnvironmentAWS.java
@Override public CreateClusterEnvironmentAWS createSubnet() { /////////////////////////////////////////////////////////////////////// ///// check for unused Subnet Cidr and create one DescribeSubnetsRequest describesubnetsreq = new DescribeSubnetsRequest(); DescribeSubnetsResult describesubnetres = cluster.getEc2().describeSubnets(describesubnetsreq); List<Subnet> loSubnets = describesubnetres.getSubnets(); List<String> listofUsedCidr = new ArrayList<>(); // contains all subnet.cidr which are in current vpc for (Subnet sn : loSubnets) { if (sn.getVpcId().equals(vpc.getVpcId())) { listofUsedCidr.add(sn.getCidrBlock()); }/*from w w w . j a va 2 s . c om*/ } SubNets subnets = new SubNets(vpc.getCidrBlock(), 24); String SUBNETCIDR = subnets.nextCidr(listofUsedCidr); log.debug(V, "Use {} for generated SubNet.", SUBNETCIDR); // create new subnetdir CreateSubnetRequest createsubnetreq = new CreateSubnetRequest(vpc.getVpcId(), SUBNETCIDR); createsubnetreq.withAvailabilityZone(cluster.getConfig().getAvailabilityZone()); CreateSubnetResult createsubnetres = cluster.getEc2().createSubnet(createsubnetreq); subnet = createsubnetres.getSubnet(); return this; }