本文整理汇总了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);
}
}
}
}
示例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);
}
示例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);
}
示例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;
}