Java 类com.amazonaws.services.ec2.model.CreateSubnetResult 实例源码

项目:photon-model    文件:AWSNetworkClient.java   
/**
 * Async create the subnet and return it.
 */
public DeferredResult<Subnet> createSubnetAsync(String subnetCidr, String vpcId, String zoneId) {

    CreateSubnetRequest req = new CreateSubnetRequest()
            .withCidrBlock(subnetCidr)
            .withVpcId(vpcId)
            .withAvailabilityZone(zoneId);

    String message = "Create AWS Subnet with CIDR [" + subnetCidr
            + "] for vpc id [" + vpcId + "].";

    AWSDeferredResultAsyncHandler<CreateSubnetRequest, CreateSubnetResult> handler = new
            AWSDeferredResultAsyncHandler<>(this.service, message);
    this.client.createSubnetAsync(req, handler);
    return handler.toDeferredResult()
            .thenApply(CreateSubnetResult::getSubnet);
}
项目:photon-model    文件:AWSNetworkClient.java   
/**
 * Creates the subnet and return it.
 */
public Subnet createSubnet(String subnetCidr, String vpcId) {
    CreateSubnetRequest req = new CreateSubnetRequest()
            .withCidrBlock(subnetCidr)
            .withVpcId(vpcId);
    CreateSubnetResult res = this.client.createSubnet(req);
    return res.getSubnet();
}
项目:photon-model    文件:TestAWSSetupUtils.java   
/**
 * Creates a Subnet if not exist and return the Subnet id.
 */
public static String createOrGetSubnet(AmazonEC2AsyncClient client, String subnetCidr,
        String vpcId, String zoneId) {
    List<Filter> filters = new ArrayList<>();
    Filter cidrBlockFilter = new Filter();
    cidrBlockFilter.withName("cidrBlock");
    cidrBlockFilter.withValues(subnetCidr);
    filters.add(cidrBlockFilter);

    if (zoneId != null) {
        Filter azFilter = new Filter();
        azFilter.withName("availabilityZone");
        azFilter.withValues(zoneId);
        filters.add(azFilter);
    }

    DescribeSubnetsResult result = client.describeSubnets(new DescribeSubnetsRequest()
            .withFilters(filters));
    if (result.getSubnets() != null && !result.getSubnets().isEmpty()) {
        return result.getSubnets().get(0).getSubnetId();
    } else {
        CreateSubnetRequest req = new CreateSubnetRequest()
                .withCidrBlock(subnetCidr)
                .withVpcId(vpcId);
        if (zoneId != null) {
            req.withAvailabilityZone(zoneId);
        }
        CreateSubnetResult res = client.createSubnet(req);
        return res.getSubnet().getSubnetId();
    }
}
项目:aws-sdk-java-resources    文件:VpcImpl.java   
@Override
public Subnet createSubnet(CreateSubnetRequest request,
        ResultCapture<CreateSubnetResult> extractor) {

    ActionResult result = resource.performAction("CreateSubnet", request,
            extractor);

    if (result == null) return null;
    return new SubnetImpl(result.getResource());
}
项目:aws-sdk-java-resources    文件:VpcImpl.java   
@Override
public Subnet createSubnet(String cidrBlock,
        ResultCapture<CreateSubnetResult> extractor) {

    CreateSubnetRequest request = new CreateSubnetRequest()
        .withCidrBlock(cidrBlock);
    return createSubnet(request, extractor);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public Subnet createSubnet(CreateSubnetRequest request,
        ResultCapture<CreateSubnetResult> extractor) {

    ActionResult result = service.performAction("CreateSubnet", request,
            extractor);

    if (result == null) return null;
    return new SubnetImpl(result.getResource());
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public Subnet createSubnet(String cidrBlock, String vpcId,
        ResultCapture<CreateSubnetResult> extractor) {

    CreateSubnetRequest request = new CreateSubnetRequest()
        .withCidrBlock(cidrBlock)
        .withVpcId(vpcId);
    return createSubnet(request, extractor);
}
项目:aws-mock    文件:BaseTest.java   
/**
 * Create Subnet.
 *
 * @param cidrBlock the cidr block
 * @param vpcId the vpc id
 * @return Subnet
 */
protected final Subnet createSubnet(final String cidrBlock, final String vpcId) {
    Subnet subnet = null;

    CreateSubnetRequest req = new CreateSubnetRequest();
    req.setCidrBlock(cidrBlock);
    req.setVpcId(vpcId);
    CreateSubnetResult result = amazonEC2Client.createSubnet(req);
    if (result != null) {
        subnet = result.getSubnet();
    }

    return subnet;
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public CreateSubnetResult createSubnet(CreateSubnetRequest createSubnetRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:aws-sdk-java-resources    文件:VpcImpl.java   
@Override
public Subnet createSubnet(String cidrBlock) {
    return createSubnet(cidrBlock, (ResultCapture<CreateSubnetResult>)null);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public Subnet createSubnet(String cidrBlock, String vpcId) {
    return createSubnet(cidrBlock, vpcId,
            (ResultCapture<CreateSubnetResult>)null);
}
项目:aws-sdk-java-resources    文件:Vpc.java   
/**
 * Performs the <code>CreateSubnet</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Vpc</code> resource, and any conflicting parameter value set in the
 * request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>VpcId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The <code>Subnet</code> resource object associated with the
 *         result of this action.
 * @see CreateSubnetRequest
 */
Subnet createSubnet(CreateSubnetRequest request,
        ResultCapture<CreateSubnetResult> extractor);
项目:aws-sdk-java-resources    文件:Vpc.java   
/**
 * The convenient method form for the <code>CreateSubnet</code> action.
 *
 * @see #createSubnet(CreateSubnetRequest, ResultCapture)
 */
Subnet createSubnet(String cidrBlock, ResultCapture<CreateSubnetResult>
        extractor);
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * Performs the <code>CreateSubnet</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 *
 * @return The <code>Subnet</code> resource object associated with the
 *         result of this action.
 * @see CreateSubnetRequest
 */
com.amazonaws.resources.ec2.Subnet createSubnet(CreateSubnetRequest request,
        ResultCapture<CreateSubnetResult> extractor);
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * The convenient method form for the <code>CreateSubnet</code> action.
 *
 * @see #createSubnet(CreateSubnetRequest, ResultCapture)
 */
com.amazonaws.resources.ec2.Subnet createSubnet(String cidrBlock, String
        vpcId, ResultCapture<CreateSubnetResult> extractor);