Sha256: 9ac88e72da60a9ed3a12d14876002fca5b666b566bc12c85ccd5b9237e28b12f

Contents?: true

Size: 1.16 KB

Versions: 19

Compression:

Stored size: 1.16 KB

Contents

require 'aws_pocketknife'
require 'base64'
require 'openssl'

module AwsPocketknife
  module Asg

    class << self
      include AwsPocketknife::Common::Utils

      def describe_asg_by_name(name: "")
        asg_list = name.split(";")
        asg_client.describe_auto_scaling_groups({auto_scaling_group_names: asg_list, })
      end

      def list(max_records: 100)
        asgs = []
        resp = asg_client.describe_auto_scaling_groups({
                                max_records: max_records,
                            })
        asgs << resp.auto_scaling_groups
        next_token = resp.next_token
        while true
          break if next_token.nil? or next_token.empty?
          resp = get_asgs(next_token: next_token, max_records: max_records)
          asgs << resp.auto_scaling_groups
          next_token = resp.next_token

        end

        asgs.flatten!

      end

      private

      def get_asgs(next_token: "", max_records: 100)

        asg_client.describe_auto_scaling_groups({
                                max_records: max_records,
                                next_token: next_token,
                            })

      end

    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
aws_pocketknife-0.1.28 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.27 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.26 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.25 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.24 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.23 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.21 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.20 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.19 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.18 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.17 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.16 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.15 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.14 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.13 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.12 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.11 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.10 lib/aws_pocketknife/asg.rb
aws_pocketknife-0.1.9 lib/aws_pocketknife/asg.rb