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.20.2 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.20.1 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.20.0 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.19.0 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.18.2 lib/awspec/helper/finder/cloudwatch.rb
awspec-0.18.1 lib/awspec/helper/finder/cloudwatch.rb