Sha256: 86e9b3d64acce728d2b4aa038995ae9a9511a7c7f7efb8625e1aeb0d8bf53148

Contents?: true

Size: 1.41 KB

Versions: 98

Compression:

Stored size: 1.41 KB

Contents

module Fog
  module AWS
    class CloudWatch
      class Real
        require 'fog/aws/parsers/cloud_watch/delete_alarms'

        # Delete a list of alarms
        # ==== Options
        # * AlarmNames<~Array>: A list of alarms to be deleted
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/index.html?API_DeleteAlarms.html
        #

        def delete_alarms(alarm_names)
          options = {}
          options.merge!(AWS.indexed_param('AlarmNames.member.%d', [*alarm_names]))
          request({
              'Action'    => 'DeleteAlarms',
              :parser     => Fog::Parsers::AWS::CloudWatch::DeleteAlarms.new
            }.merge(options))
        end
      end

      class Mock
        def delete_alarms(alarm_names)
          [*alarm_names].each do |alarm_name|
            unless data[:metric_alarms].key?(alarm_name)
              raise Fog::AWS::AutoScaling::NotFound, "The alarm '#{alarm_name}' does not exist."
            end
          end

          [*alarm_names].each { |alarm_name| data[:metric_alarms].delete(alarm_name) }
          response = Excon::Response.new
          response.status = 200
          response.body = {
            'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
          }
          response
        end
      end
    end
  end
end

Version data entries

98 entries across 96 versions & 6 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.29.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.28.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.27.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.26.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.25.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.24.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.23.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.22.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.21.1 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.21.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.20.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.19.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.18.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.17.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.16.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.15.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.14.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.13.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-aws-3.12.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb