public MockVpc createVpc ( final String cidrBlock , final String instanceTenancy ) { MockVpc ret = new MockVpc ( ) ; ret . setCidrBlock ( cidrBlock ) ; ret . setVpcId ( "vpc-" + UUID . randomUUID ( ) . toString ( ) . substring ( 0 , VPC_ID_POSTFIX_LENGTH ) ) ; ret . setInstanceTenancy ( instanceTenancy ) ; // Make sure only one VPC is default. synchronized ( this ) { if ( allMockVpcInstances . size ( ) == 0 ) { ret . setIsDefault ( true ) ; } else { ret . setIsDefault ( false ) ; } allMockVpcInstances . put ( ret . getVpcId ( ) , ret ) ; } return ret ; }
Create the mock VPC .