# File lib/aws/auto_scaling/notification_configuration_collection.rb, line 134
      def each &block

        #
        # <grumble> We can't use the standard pageable collection mixin here.
        # When you provide :max_records it returns each notification
        # type as an individual record, instead of notification configurations
        # with grouped types.  This makes it very possible to
        # get a part of a configuration in one page of results with the
        # rest in the next page.
        #
        # So instead we will request and group them all before yielding.
        #

        next_token = nil

        groups = {}

        begin

          client_opts = {}
          client_opts[:next_token] = next_token if next_token
          client_opts[:auto_scaling_group_names] = [@group.name] if @group

          resp = client.describe_notification_configurations(client_opts)
          resp.notification_configurations.each do |c|
            group_name = c.auto_scaling_group_name
            groups[group_name] ||= {}
            groups[group_name][c.topic_arn] ||= []
            groups[group_name][c.topic_arn] << c.notification_type
          end

          next_token = resp.data[:next_token]

        end while next_token

        groups.each_pair do |group_name, topics|
          topics.each_pair do |topic_arn, types|

            notification_config = NotificationConfiguration.new(
              Group.new(group_name, :config => config), topic_arn, types)

            yield(notification_config)

          end
        end

      end