Sha256: 8a635e7bef365a0fcf76b45b65ca3532756a990d091784ef32a52e2e3bd07f18

Contents?: true

Size: 778 Bytes

Versions: 26

Compression:

Stored size: 778 Bytes

Contents

module Awspec::Helper
  module Finder
    module Cloudwatch
      def find_cloudwatch_alarm(id)
        res = @cloudwatch_client.describe_alarms({
                                                   alarm_names: [id]
                                                 })
        return res[:metric_alarms].first if res[:metric_alarms].count == 1

        res = @cloudwatch_client.describe_alarms
        res[:metric_alarms].find do |alarm|
          alarm[:alarm_arn] == id
        end
      end

      def select_all_cloudwatch_alarms
        selected = []
        res = @cloudwatch_client.describe_alarms

        loop do
          selected += res.metric_alarms
          (res.next_page? && res = res.next_page) || break
        end

        selected
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
awspec-0.26.2 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.26.1 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.26.0 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.25.3 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.25.2 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.25.1 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.25.0 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.24.2 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.24.1 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.24.0 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.23.0 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.22.1 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.22.0 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.21.6 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.21.5 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.21.4 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.21.3 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.21.2 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.21.1 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.21.0 lib/awspec/helper/finder/cloudwatch.rb