/** * Creates the VPC and returns the VPC id */ public String createVPC(String subnetCidr) { CreateVpcRequest req = new CreateVpcRequest().withCidrBlock(subnetCidr); CreateVpcResult vpc = this.client.createVpc(req); return vpc.getVpc().getVpcId(); }
public Vpc createVPC() throws InterruptedException { logger.info("create VPC"); String vpcId = ec2.createVpc(new CreateVpcRequest().withCidrBlock("10.0.0.0/16")).getVpc().getVpcId(); while (true) { Threads.sleepRoughly(Duration.ofSeconds(20)); DescribeVpcsResult result = ec2.describeVpcs(new DescribeVpcsRequest().withVpcIds(vpcId)); Vpc remoteVPC = result.getVpcs().get(0); if ("available".equals(remoteVPC.getState())) { enableVPCDNS(vpcId); return remoteVPC; } } }
@Override public Vpc createVpc(CreateVpcRequest request, ResultCapture<CreateVpcResult> extractor) { ActionResult result = service.performAction("CreateVpc", request, extractor); if (result == null) return null; return new VpcImpl(result.getResource()); }
@Override public Vpc createVpc(String cidrBlock, ResultCapture<CreateVpcResult> extractor) { CreateVpcRequest request = new CreateVpcRequest() .withCidrBlock(cidrBlock); return createVpc(request, extractor); }
/** * Create VPC. * * @param cidrBlock the cidr block * @param instanceTenancy the instance tenancy * @return New vpc */ protected final Vpc createVpc(final String cidrBlock, final String instanceTenancy) { CreateVpcRequest req = new CreateVpcRequest(); req.setCidrBlock(cidrBlock); req.setInstanceTenancy(instanceTenancy); CreateVpcResult result = amazonEC2Client.createVpc(req); return result.getVpc(); }
@Override public CreateVpcResult createVpc(CreateVpcRequest createVpcRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Not supported in mock"); }
/** * Creates a VPC and returns the VPC id. */ public static String createVPC(AmazonEC2AsyncClient client, String subnetCidr) { return client.createVpc(new CreateVpcRequest().withCidrBlock(subnetCidr)).getVpc().getVpcId(); }
@Override public Vpc createVpc(CreateVpcRequest request) { return createVpc(request, null); }
/** * Performs the <code>CreateVpc</code> action. * * <p> * * @return The <code>Vpc</code> resource object associated with the result * of this action. * @see CreateVpcRequest */ com.amazonaws.resources.ec2.Vpc createVpc(CreateVpcRequest request);
/** * Performs the <code>CreateVpc</code> action and use a ResultCapture to * retrieve the low-level client response. * * <p> * * @return The <code>Vpc</code> resource object associated with the result * of this action. * @see CreateVpcRequest */ com.amazonaws.resources.ec2.Vpc createVpc(CreateVpcRequest request, ResultCapture<CreateVpcResult> extractor);