Sha256: 1b575119fd60fe3b9249db3c06f0b113036e16f2d1626de6b59147686cf7b74d

Contents?: true

Size: 1.41 KB

Versions: 75

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].has_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

75 entries across 75 versions & 11 rubygems

Version Path
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-1.20.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-1.19.0 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/aws/requests/cloud_watch/delete_alarms.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/requests/cloud_watch/delete_alarms.rb