本文整理汇总了Java中com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult类的典型用法代码示例。如果您正苦于以下问题:Java DescribeInternetGatewaysResult类的具体用法?Java DescribeInternetGatewaysResult怎么用?Java DescribeInternetGatewaysResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DescribeInternetGatewaysResult类属于com.amazonaws.services.ec2.model包,在下文中一共展示了DescribeInternetGatewaysResult类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: validateExistingIGW
import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入依赖的package包/类
private void validateExistingIGW(AwsNetworkView awsNetworkView, AmazonEC2Client amazonEC2Client) {
if (awsNetworkView.isExistingIGW()) {
DescribeInternetGatewaysRequest describeInternetGatewaysRequest = new DescribeInternetGatewaysRequest();
describeInternetGatewaysRequest.withInternetGatewayIds(awsNetworkView.getExistingIGW());
DescribeInternetGatewaysResult describeInternetGatewaysResult = amazonEC2Client.describeInternetGateways(describeInternetGatewaysRequest);
if (describeInternetGatewaysResult.getInternetGateways().size() < 1) {
throw new CloudConnectorException(String.format(IGW_DOES_NOT_EXIST_MSG, awsNetworkView.getExistingIGW()));
} else {
InternetGateway internetGateway = describeInternetGatewaysResult.getInternetGateways().get(0);
InternetGatewayAttachment attachment = internetGateway.getAttachments().get(0);
if (attachment != null && !attachment.getVpcId().equals(awsNetworkView.getExistingVPC())) {
throw new CloudConnectorException(String.format(IGWVPC_DOES_NOT_EXIST_MSG, awsNetworkView.getExistingIGW(),
awsNetworkView.getExistingVPC()));
}
}
}
}
示例3: 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);
}
示例4: 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);
}
示例5: describeInternetGateways
import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入依赖的package包/类
@Override
public List<AbstractResource<?>> describeInternetGateways(Account account, Region region, DateTime dt, Ec2Filter... filters) {
AmazonEC2 ec2 = findClient(account, region);
DescribeInternetGatewaysRequest req = new DescribeInternetGatewaysRequest();
for (Ec2Filter filter : filters) {
Filter f = new Filter().withName(filter.getName()).withValues(filter.getValues());
req.withFilters(f);
}
log.debug("start describing internet gateways for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
DescribeInternetGatewaysResult res = ec2.describeInternetGateways(req);
return converter.toVpcInternetGateways(res.getInternetGateways(), account.getId(), region, dt);
}
示例6: getInternetGateway
import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入依赖的package包/类
/**
* Describe internet gateway.
*
* @return InternetGateway
*/
protected final InternetGateway getInternetGateway() {
InternetGateway internetGateway = null;
DescribeInternetGatewaysRequest req = new DescribeInternetGatewaysRequest();
DescribeInternetGatewaysResult result = amazonEC2Client.describeInternetGateways(req);
if (result != null && !result.getInternetGateways().isEmpty()) {
internetGateway = result.getInternetGateways().get(0);
}
return internetGateway;
}
示例7: 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;
}
示例8: describeInternetGateways
import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入依赖的package包/类
@Override
public DescribeInternetGatewaysResult describeInternetGateways(DescribeInternetGatewaysRequest describeInternetGatewaysRequest) throws AmazonServiceException, AmazonClientException {
throw new UnsupportedOperationException("Not supported in mock");
}
示例9: load
import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入依赖的package包/类
@Override
public boolean load(DescribeInternetGatewaysRequest request,
ResultCapture<DescribeInternetGatewaysResult> extractor) {
return resource.load(request, extractor);
}
示例10: load
import com.amazonaws.services.ec2.model.DescribeInternetGatewaysResult; //导入依赖的package包/类
/**
* Makes a call to the service to load this resource's attributes if they
* are not loaded yet, and use a ResultCapture to retrieve the low-level
* client response
* The following request parameters will be populated from the data of this
* <code>InternetGateway</code> resource, and any conflicting parameter
* value set in the request will be overridden:
* <ul>
* <li>
* <b><code>InternetGatewayIds.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 DescribeInternetGatewaysRequest
*/
boolean load(DescribeInternetGatewaysRequest request,
ResultCapture<DescribeInternetGatewaysResult> extractor);