Class: AwsCftTools::AWSEnumerator

Inherits:
Enumerator
  • Object
show all
Defined in:
lib/aws_cft_tools/aws_enumerator.rb

Overview

Provides common “closure” of paged results for the CFT client.

Instance Method Summary collapse

Constructor Details

#initialize(client, method, args = {}) {|Object| ... } ⇒ AWSEnumerator

Returns a new instance of AWSEnumerator.

Examples:

Enumerating All Stacks


aws_client = Aws::CloudFormation::Client.new
all_stacks = AWSEnumerator.new(aws_client, :describe_stacks, &:stacks).to_a

Parameters:

  • client (Object)

    The client object used to retrieve the next set of responses.

  • method (Symbol)

    The method to call on the client object.

  • args (Hash) (defaults to: {})

    Any arguments that are the same across calls to the client object.

Yields:

  • (Object)

    The response from calling the method on the client.



19
20
21
22
23
24
25
26
27
28
# File 'lib/aws_cft_tools/aws_enumerator.rb', line 19

def initialize(client, method, args = {}, &block)
  @client = client
  @method = method
  @next_token = nil
  @args = args

  super() do |yielder|
    run_loop(yielder, &block)
  end
end