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

项目:photon-model    文件:AWSTaskStatusChecker.java   
private void runSearch(T type) {
    AmazonWebServiceRequest descRequest = buildRequest(type);
    AsyncHandler describeHandler = buildHandler(type);
    if (type instanceof Instance) {
        this.amazonEC2Client.describeInstancesAsync(
                (DescribeInstancesRequest) descRequest, describeHandler);
    } else if (type instanceof NatGateway) {
        this.amazonEC2Client.describeNatGatewaysAsync(
                (DescribeNatGatewaysRequest) descRequest, describeHandler);
    } else if (type instanceof Volume) {
        this.amazonEC2Client.describeVolumesAsync(
                (DescribeVolumesRequest) descRequest, describeHandler);
    } else {
        AWSTaskStatusChecker.this.taskManager.patchTaskToFailure(
                new IllegalArgumentException("Invalid type " + type));
    }
}
项目:cmn-project    文件:NATLoader.java   
@Override
public void load() {
    VPC vpc = resources.onlyOne(VPC.class).get();

    if (vpc.remoteVPC != null) {
        List<NatGateway> gateways = AWS.vpc.ec2.describeNatGateways(new DescribeNatGatewaysRequest()
            .withFilter(new Filter("state").withValues("available"),
                new Filter("vpc-id").withValues(vpc.remoteVPC.getVpcId())))
            .getNatGateways();

        if (gateways.size() > 1) throw new Error(Strings.format("multiple nat gateway found, gateways={}", gateways));
        if (!gateways.isEmpty()) {
            NATGateway gateway = resources.onlyOne(NATGateway.class).orElseGet(() -> resources.add(new NATGateway()));
            gateway.remoteNATGateway = gateways.get(0);
            gateway.foundInRemote();
        }
    }
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public DescribeNatGatewaysResult describeNatGateways(DescribeNatGatewaysRequest describeNatGatewaysRequest) {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:cmn-project    文件:EC2VPC.java   
private NatGateway describeNATGateway(String gatewayId) {
    DescribeNatGatewaysResult result = ec2.describeNatGateways(new DescribeNatGatewaysRequest().withNatGatewayIds(gatewayId));
    return result.getNatGateways().get(0);
}