当前位置: 首页>>代码示例>>Java>>正文


Java DescribeInternetGatewaysResult.getInternetGateways方法代码示例

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


在下文中一共展示了DescribeInternetGatewaysResult.getInternetGateways方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: consumeSuccess

import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入方法依赖的package包/类
/**
 * Update the Internet gateway information for the VPC in question. For the list of Internet
 * gateways received based on the vpc filter work through the list of attachments and VPCs
 * and update the Internet gateway information in the network state that maps to the VPC.
 */
@Override
protected void consumeSuccess(DescribeInternetGatewaysRequest request,
        DescribeInternetGatewaysResult result) {
    for (InternetGateway resultGateway : result.getInternetGateways()) {
        for (InternetGatewayAttachment attachment : resultGateway.getAttachments()) {
            if (this.context.vpcs.containsKey(attachment.getVpcId())) {
                NetworkState networkStateToUpdate = this.context.vpcs
                        .get(attachment.getVpcId());
                networkStateToUpdate.customProperties.put(AWS_GATEWAY_ID,
                        resultGateway.getInternetGatewayId());
                this.context.vpcs.put(attachment.getVpcId(), networkStateToUpdate);
            }
        }
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:21,代码来源:AWSNetworkStateEnumerationAdapterService.java

示例2: getInternetGateway

import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入方法依赖的package包/类
public InternetGateway getInternetGateway(String resourceId) {
    DescribeInternetGatewaysRequest req = new DescribeInternetGatewaysRequest()
            .withInternetGatewayIds(resourceId);
    DescribeInternetGatewaysResult res = this.client.describeInternetGateways(req);
    List<InternetGateway> internetGateways = res.getInternetGateways();
    return internetGateways.isEmpty() ? null : internetGateways.get(0);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:8,代码来源:AWSNetworkClient.java

示例3: gateways

import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入方法依赖的package包/类
@Override
public CloudGateWays gateways(CloudCredential cloudCredential, Region region, Map<String, String> filters) throws Exception {
    AmazonEC2Client ec2Client = awsClient.createAccess(cloudCredential);

    Map<String, Set<CloudGateWay>> resultCloudGateWayMap = new HashMap<>();
    CloudRegions regions = regions(cloudCredential, region, filters);

    for (Map.Entry<Region, List<AvailabilityZone>> regionListEntry : regions.getCloudRegions().entrySet()) {
        if (region == null || Strings.isNullOrEmpty(region.value()) || regionListEntry.getKey().value().equals(region.value())) {
            ec2Client.setRegion(RegionUtils.getRegion(regionListEntry.getKey().value()));

            DescribeInternetGatewaysRequest describeInternetGatewaysRequest = new DescribeInternetGatewaysRequest();
            DescribeInternetGatewaysResult describeInternetGatewaysResult = ec2Client.describeInternetGateways(describeInternetGatewaysRequest);

            Set<CloudGateWay> gateWays = new HashSet<>();
            for (InternetGateway internetGateway : describeInternetGatewaysResult.getInternetGateways()) {
                CloudGateWay cloudGateWay = new CloudGateWay();
                cloudGateWay.setId(internetGateway.getInternetGatewayId());
                cloudGateWay.setName(internetGateway.getInternetGatewayId());
                List<String> vpcs = new ArrayList<>();
                for (InternetGatewayAttachment internetGatewayAttachment : internetGateway.getAttachments()) {
                    vpcs.add(internetGatewayAttachment.getVpcId());
                }
                Map<String, Object> properties = new HashMap<>();
                properties.put("attachment", vpcs);
                cloudGateWay.setProperties(properties);
                gateWays.add(cloudGateWay);
            }
            for (AvailabilityZone availabilityZone : regionListEntry.getValue()) {
                resultCloudGateWayMap.put(availabilityZone.value(), gateWays);
            }
        }
    }
    return new CloudGateWays(resultCloudGateWayMap);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:36,代码来源:AwsPlatformResources.java

示例4: getInternetGateways

import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入方法依赖的package包/类
/**
* Describe internet gateways.
*
* @return List of InternetGateway
*/
protected final List<InternetGateway> getInternetGateways() {
   List<InternetGateway> internetGateways = null;
   DescribeInternetGatewaysRequest req = new DescribeInternetGatewaysRequest();
   DescribeInternetGatewaysResult result = amazonEC2Client.describeInternetGateways(req);
   if (result != null && !result.getInternetGateways().isEmpty()) {
       internetGateways = result.getInternetGateways();
   }

   return internetGateways;
}
 
开发者ID:treelogic-swe,项目名称:aws-mock,代码行数:16,代码来源:BaseTest.java


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