• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DescribeVpcsRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.ec2.model.DescribeVpcsRequest的典型用法代码示例。如果您正苦于以下问题:Java DescribeVpcsRequest类的具体用法?Java DescribeVpcsRequest怎么用?Java DescribeVpcsRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DescribeVpcsRequest类属于com.amazonaws.services.ec2.model包,在下文中一共展示了DescribeVpcsRequest类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getVpcInRegion

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
@Override
@Cacheable(value = CachingConfiguration.VPC_CACHE, key = "#vpcId", condition = "#bypassCache == false")
public Vpc getVpcInRegion(final String vpcId, final String region, boolean bypassCache) {
    Preconditions.checkArgument(StringUtils.isNotBlank(vpcId), "vpcId may not be null or blank");
    Preconditions.checkArgument(StringUtils.isNotBlank(region), "region may not be null or blank");

    LOG.info("Retrieving VPC {} in region {} ({})", vpcId, region, bypassCache);
    DescribeVpcsRequest request = new DescribeVpcsRequest()
        .withVpcIds(vpcId);
    DescribeVpcsResult result = getClientForRegion(region).describeVpcs(request);

    List<Vpc> results = result.getVpcs();

    if (results.size() != 1) {
        throw new IllegalArgumentException("Did not get expected result");
    }

    return results.get(0);
}
 
开发者ID:kylesm,项目名称:vpcviewer,代码行数:20,代码来源:VpcServiceImpl.java


示例2: findNonOverLappingCIDR

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
protected String findNonOverLappingCIDR(AuthenticatedContext ac, CloudStack stack) {
    AwsNetworkView awsNetworkView = new AwsNetworkView(stack.getNetwork());
    String region = ac.getCloudContext().getLocation().getRegion().value();
    AmazonEC2Client ec2Client = awsClient.createAccess(new AwsCredentialView(ac.getCloudCredential()), region);

    DescribeVpcsRequest vpcRequest = new DescribeVpcsRequest().withVpcIds(awsNetworkView.getExistingVPC());
    Vpc vpc = ec2Client.describeVpcs(vpcRequest).getVpcs().get(0);
    String vpcCidr = vpc.getCidrBlock();
    LOGGER.info("Subnet cidr is empty, find a non-overlapping subnet for VPC cidr: {}", vpcCidr);

    DescribeSubnetsRequest request = new DescribeSubnetsRequest().withFilters(new Filter("vpc-id", singletonList(awsNetworkView.getExistingVPC())));
    List<Subnet> awsSubnets = ec2Client.describeSubnets(request).getSubnets();
    List<String> subnetCidrs = awsSubnets.stream().map(Subnet::getCidrBlock).collect(Collectors.toList());
    LOGGER.info("The selected VPCs: {}, has the following subnets: {}", vpc.getVpcId(), subnetCidrs.stream().collect(Collectors.joining(",")));

    return calculateSubnet(ac.getCloudContext().getName(), vpc, subnetCidrs);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:18,代码来源:AwsResourceConnector.java


示例3: getVPC

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
public Vpc getVPC(String vpcId) {
    DescribeVpcsRequest req = new DescribeVpcsRequest().withVpcIds(vpcId);
    DescribeVpcsResult result = this.client.describeVpcs(req);
    List<Vpc> vpcs = result.getVpcs();
    if (vpcs != null && vpcs.size() == 1) {
        return vpcs.get(0);
    }
    return null;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:10,代码来源:AWSNetworkClient.java


示例4: getDefaultVPC

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
/**
 * Get the default VPC - return null if no default specified
 */
public Vpc getDefaultVPC() {
    DescribeVpcsRequest req = new DescribeVpcsRequest();
    DescribeVpcsResult result = this.client.describeVpcs(req);
    List<Vpc> vpcs = result.getVpcs();
    for (Vpc vpc : vpcs) {
        if (vpc.isDefault()) {
            return vpc;
        }
    }
    return null;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:15,代码来源:AWSNetworkClient.java


示例5: consumeSuccess

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
@Override
protected void consumeSuccess(DescribeVpcsRequest request, DescribeVpcsResult result) {

    URI adapterUri = AdapterUriUtil.buildAdapterUri(getHost(),
            AWSUriPaths.AWS_NETWORK_ADAPTER);
    for (Vpc resultVPC : result.getVpcs()) {
        NetworkState networkState = mapVPCToNetworkState(resultVPC,
                this.context.request.regionId,
                this.context.request.request.resourcePoolLink,
                this.context.request.request.endpointLink,
                this.context.request.endpointAuth.documentSelfLink,
                this.context.request.parentComputeLink,
                this.context.request.tenantLinks,
                adapterUri);
        if (networkState.subnetCIDR == null) {
            logWarning(() -> String.format("AWS did not return CIDR information for VPC %s",
                    resultVPC.toString()));
        }
        this.context.awsVpcs.put(resultVPC.getVpcId(), resultVPC);
        this.context.vpcs.put(resultVPC.getVpcId(), networkState);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:23,代码来源:AWSNetworkStateEnumerationAdapterService.java


示例6: createVPC

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
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;
        }
    }
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:15,代码来源:EC2VPC.java


示例7: networks

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
@Override
public CloudNetworks networks(CloudCredential cloudCredential, Region region, Map<String, String> filters) {
    Map<String, Set<CloudNetwork>> result = new HashMap<>();
    Set<CloudNetwork> cloudNetworks = new HashSet<>();
    AmazonEC2Client ec2Client = awsClient.createAccess(new AwsCredentialView(cloudCredential), region.value());

    //create vpc filter view
    PlatformResourceVpcFilterView filter = new PlatformResourceVpcFilterView(filters);

    DescribeVpcsRequest describeVpcsRequest = new DescribeVpcsRequest();
    // If the filtervalue is provided then we should filter only for those vpc
    if (!Strings.isNullOrEmpty(filter.getVpcId())) {
        describeVpcsRequest.withVpcIds(filter.getVpcId());
    }
    for (Vpc vpc : ec2Client.describeVpcs(describeVpcsRequest).getVpcs()) {
        Map<String, String> subnetMap = new HashMap<>();
        List<Subnet> subnets = ec2Client.describeSubnets(createVpcDescribeRequest(vpc)).getSubnets();
        Map<String, Object> properties = new HashMap<>();
        properties.put("cidrBlock", vpc.getCidrBlock());
        properties.put("default", vpc.getIsDefault());
        properties.put("dhcpOptionsId", vpc.getDhcpOptionsId());
        properties.put("instanceTenancy", vpc.getInstanceTenancy());
        properties.put("state", vpc.getState());
        for (Subnet subnet : subnets) {
            subnetMap.put(subnet.getSubnetId(), subnet.getSubnetId());
        }
        cloudNetworks.add(new CloudNetwork(vpc.getVpcId(), vpc.getVpcId(), subnetMap, properties));
    }
    result.put(region.value(), cloudNetworks);
    return new CloudNetworks(result);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:32,代码来源:AwsPlatformResources.java


示例8: describeVpcs

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
@Override
public List<AbstractResource<?>> describeVpcs(Account account, Region region, DateTime dt, Ec2Filter... filters) {
    AmazonEC2 ec2 = findClient(account, region);

    DescribeVpcsRequest req = new DescribeVpcsRequest();
    for (Ec2Filter filter : filters) {
        Filter f = new Filter().withName(filter.getName()).withValues(filter.getValues());
        req.withFilters(f);
    }

    log.debug("start describing vpcs for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
    DescribeVpcsResult res = ec2.describeVpcs(req);

    return converter.toVpcVpcs(res.getVpcs(), account.getId(), region, dt);
}
 
开发者ID:veyronfei,项目名称:clouck,代码行数:16,代码来源:Ec2WrapperImpl.java


示例9: describeVpcs

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
/**
 * Describe VPCs.
 *
 * @return List of vpcs
 */
protected final List<Vpc> describeVpcs() {
    DescribeVpcsRequest req = new DescribeVpcsRequest();
    DescribeVpcsResult result = amazonEC2Client.describeVpcs(req);
    List<Vpc> vpcs = result.getVpcs();
    return vpcs;
}
 
开发者ID:treelogic-swe,项目名称:aws-mock,代码行数:12,代码来源:BaseTest.java


示例10: describeVpcs

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
@Override
public DescribeVpcsResult describeVpcs(DescribeVpcsRequest describeVpcsRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonEC2Mock.java


示例11: refreshVPCInformation

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
private void refreshVPCInformation(AWSNetworkStateCreationContext aws,
        AWSNetworkStateCreationStage next) {
    DescribeVpcsRequest vpcRequest = new DescribeVpcsRequest();
    AWSVPCAsyncHandler asyncHandler = new AWSVPCAsyncHandler(next, aws);
    aws.amazonEC2Client.describeVpcsAsync(vpcRequest, asyncHandler);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:7,代码来源:AWSNetworkStateEnumerationAdapterService.java


示例12: describeVPC

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
public Vpc describeVPC(String vpcId) {
    logger.info("describe vpc, vpcId={}", vpcId);
    DescribeVpcsResult result = ec2.describeVpcs(new DescribeVpcsRequest().withVpcIds(vpcId));
    return result.getVpcs().get(0);
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:6,代码来源:EC2VPC.java


示例13: load

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
@Override
public boolean load(DescribeVpcsRequest request) {
    return load(request, null);
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:5,代码来源:VpcImpl.java


示例14: getVpcs

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
@Override
public VpcCollection getVpcs() {
    return getVpcs((DescribeVpcsRequest)null);
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:5,代码来源:EC2Impl.java


示例15: load

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
/**
 * Makes a call to the service to load this resource's attributes if they
 * are not loaded yet.
 * 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>VpcIds.0</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return Returns {@code true} if the resource is not yet loaded when this
 *         method was invoked, which indicates that a service call has been
 *         made to retrieve the attributes.
 * @see DescribeVpcsRequest
 */
boolean load(DescribeVpcsRequest request);
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:22,代码来源:Vpc.java


示例16: getVpcs

import com.amazonaws.services.ec2.model.DescribeVpcsRequest; //导入依赖的package包/类
/**
 * Retrieves the Vpcs collection referenced by this resource.
 */
VpcCollection getVpcs(DescribeVpcsRequest request);
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:5,代码来源:EC2.java



注:本文中的com.amazonaws.services.ec2.model.DescribeVpcsRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TransportConstants类代码示例发布时间:2022-05-23
下一篇:
Java EntityAIVillagerInteract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap