我使用AWS云锋AWS红宝石SDK V2,的Cloudfront list_distributions,遍历结果
我想列出所有我的分布,使用list_distributions
方法
即得到的回应是PageableResponse,
当我尝试遍历看来,我只能得到一个页面的结果,
page = cloudfront.list_distributions
page.each do |page|
# only one page ....
end
但在“distribution_list”散列中,“next_marker”属性包含请求的值,并且“is_truncated”属性设置为true,如果我将再次使用next_marker调用list_distributions
方法,我会得到下一组结果...
这是为什么?
似乎很奇怪,我不得不通过迭代方式来响应?
感谢
是的,你就像是在官方SDK中描述确切的行为:http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/ListDistributions.html。我认为这是用于减少后端服务器负载的常见模式,因为在许多情况下只需要部分列表。 – 2014-12-05 21:44:09
同意,但奇怪的是,在ruby sdk中,对列表分布请求的响应是一个'PageableResponse',它假设为你做了迭代请求(如果我已经正确理解了它)? – 2014-12-06 09:18:28