2014-12-05 72 views
1

我使用AWS云锋AWS红宝石SDK V2,的Cloudfront list_distributions,遍历结果

我想列出所有我的分布,使用list_distributions方法

新的红宝石SDK(V2)

即得到的回应是PageableResponse,

当我尝试遍历看来,我只能得到一个页面的结果,

page = cloudfront.list_distributions 
page.each do |page| 
    # only one page .... 
end 

但在“distribution_list”散列中,“next_marker”属性包含请求的值,并且“is_truncated”属性设置为true,如果我将再次使用next_marker调用list_distributions方法,我会得到下一组结果...

这是为什么?

似乎很奇怪,我不得不通过迭代方式来响应?

感谢

+0

是的,你就像是在官方SDK中描述确切的行为:http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/ListDistributions.html。我认为这是用于减少后端服务器负载的常见模式,因为在许多情况下只需要部分列表。 – 2014-12-05 21:44:09

+0

同意,但奇怪的是,在ruby sdk中,对列表分布请求的响应是一个'PageableResponse',它假设为你做了迭代请求(如果我已经正确理解了它)? – 2014-12-06 09:18:28

回答

3

我从AWS讨论论坛,说这是在SDK中的错误,它应该在未来的版本中解决一个线程有一个reply

Link to the issue

+0

该修复程序已发布。 – 2014-12-11 07:03:20