AWS::Core::Collection::Simple is used by collections that always recieve every matching items in a single response.
This means:
Paging methods are simulated
Next tokens are artificial (guessable numeric offsets)
AWS services generally return all items only for requests with a small maximum number of results.
See {AWS::Core::Collection} for documentation on the available collection methods.
(see AWS::Core::Collection#each_batch)
# File lib/aws/core/collection/simple.rb, line 39 def each_batch options = {}, &block each_opts = options.dup limit = each_opts.delete(:limit) limit = limit.to_i if limit next_token = each_opts.delete(:next_token) offset = next_token ? next_token.to_i - 1 : 0 total = 0 nil_or_next_token = nil batch = [] _each_item(each_opts.dup) do |item| total += 1 # skip until we reach our offset (derived from the "next token") next if total <= offset if limit if batch.size < limit batch << item else # allow _each_item to yield one more item than needed # so we can determine if we should return a "next token" nil_or_next_token = total break end else batch << item end end yield(batch) nil_or_next_token end
# File lib/aws/core/collection/simple.rb, line 82 def _each_item options = {}, &block raise NotImplementedError end