lib/fog/aws/requests/cloud_watch/describe_alarms.rb in fog-1.4.0 vs lib/fog/aws/requests/cloud_watch/describe_alarms.rb in fog-1.5.0
- old
+ new
@@ -1,9 +1,9 @@
module Fog
module AWS
class CloudWatch
- class Real
+ class Real
require 'fog/aws/parsers/cloud_watch/describe_alarms'
# Retrieves alarms with the specified names
# ==== Options
@@ -30,9 +30,27 @@
request({
'Action' => 'DescribeAlarms',
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarms.new
}.merge(options))
end
- end
+ end
+
+ class Mock
+ def describe_alarms(options={})
+ results = { 'MetricAlarms' => [] }
+ data[:metric_alarms].each do |alarm_name, alarm_data|
+ results['MetricAlarms'] << {
+ 'AlarmName' => alarm_name
+ }.merge!(alarm_data)
+ end
+ response = Excon::Response.new
+ response.status = 200
+ response.body = {
+ 'DescribeAlarmsResult' => results,
+ 'ResponseMetadata' => { 'RequestId' => Fog::AWS::Mock.request_id }
+ }
+ response
+ end
+ end
end
end
end