2011-09-29 17:55:48 -04:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class CloudWatch
|
|
|
|
class Real
|
|
|
|
|
2011-09-30 13:51:17 -04:00
|
|
|
require 'fog/aws/parsers/cloud_watch/describe_alarms_for_metric'
|
2011-09-29 17:55:48 -04:00
|
|
|
|
2011-09-30 13:51:17 -04:00
|
|
|
# Retrieves all alarms for a single metric
|
2011-09-29 17:55:48 -04:00
|
|
|
# ==== Options
|
2011-09-30 13:51:17 -04:00
|
|
|
# * Dimensions<~Array>: a list of dimensions to filter against
|
|
|
|
# Name : The name of the dimension
|
|
|
|
# Value : The value to filter against
|
|
|
|
# * MetricName<~String>: The name of the metric
|
|
|
|
# * Namespace<~String>: The namespace of the metric
|
|
|
|
# * Period<~Integer>: The period in seconds over which the statistic is applied
|
|
|
|
# * Statistics<~String>: The statistic for the metric
|
|
|
|
# * Unit<~String> The unit for the metric
|
2011-09-29 17:55:48 -04:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
#
|
|
|
|
# ==== See Also
|
|
|
|
# http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2011-09-30 13:51:17 -04:00
|
|
|
def describe_alarms_for_metric(options)
|
|
|
|
if dimensions = options.delete('Dimensions')
|
|
|
|
options.merge!(AWS.indexed_param('Dimensions.member.%d.Name', dimensions.collect {|dimension| dimension['Name']}))
|
|
|
|
options.merge!(AWS.indexed_param('Dimensions.member.%d.Value', dimensions.collect {|dimension| dimension['Value']}))
|
2011-09-29 17:55:48 -04:00
|
|
|
end
|
|
|
|
request({
|
|
|
|
'Action' => 'DescribeAlarms',
|
2011-09-30 13:51:17 -04:00
|
|
|
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarmsForMetric.new
|
2011-09-29 17:55:48 -04:00
|
|
|
}.merge(options))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|