1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

fixing describe_alarms and describe_alarms_for_metric requests

This commit is contained in:
Michael Zeng 2011-09-30 13:55:43 -04:00
parent a3ba1a035c
commit 57f9b309aa
2 changed files with 31 additions and 31 deletions

View file

@ -3,18 +3,18 @@ module Fog
class CloudWatch
class Real
require 'fog/aws/parsers/cloud_watch/describe_alarms_for_metric'
require 'fog/aws/parsers/cloud_watch/describe_alarms'
# Retrieves all alarms for a single metric
# Retrieves alarms with the specified names
# ==== Options
# * 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
# * ActionPrefix<~String>: The action name prefix
# * AlarmNamePrefix<~String>: The alarm name prefix.
# AlarmNames cannot be specified if this parameter is specified
# * AlarmNames<~Array>: An array of alarm names to retrieve information for.
# * MaxRecords<~Integer>: The maximum number of alarm descriptions to retrieve
# * NextToken<~String>: The token returned by a previous call to indicate that there is more data available
# * NextToken<~String> The token returned by a previous call to indicate that there is more data available
# * StateValue<~String>: The state value to be used in matching alarms
#
# ==== Returns
# * response<~Excon::Response>:
@ -24,18 +24,16 @@ module Fog
#
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']}))
def describe_alarms(options={})
if alarm_names = options.delete('AlarmNames')
options.merge!(AWS.indexed_param('AlarmNames.member.%d', [*alarm_names]))
end
request({
'Action' => 'DescribeAlarms',
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarmsForMetric.new
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarms.new
}.merge(options))
end
end
end
end
end
end

View file

@ -3,18 +3,18 @@ module Fog
class CloudWatch
class Real
require 'fog/aws/parsers/cloud_watch/describe_alarms'
require 'fog/aws/parsers/cloud_watch/describe_alarms_for_metric'
# Retrieves alarms with the specified names
# Retrieves all alarms for a single metric
# ==== Options
# * ActionPrefix<~String>: The action name prefix
# * AlarmNamePrefix<~String>: The alarm name prefix.
# AlarmNames cannot be specified if this parameter is specified
# * AlarmNames<~Array>: An array of alarm names to retrieve information for.
# * MaxRecords<~Integer>: The maximum number of alarm descriptions to retrieve
# * NextToken<~String>: The token returned by a previous call to indicate that there is more data available
# * NextToken<~String> The token returned by a previous call to indicate that there is more data available
# * StateValue<~String>: The state value to be used in matching alarms
# * 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
#
# ==== Returns
# * response<~Excon::Response>:
@ -24,13 +24,14 @@ module Fog
#
def describe_alarms(options={})
if alarm_names = options.delete('AlarmNames')
options.merge!(AWS.indexed_param('AlarmNames.member.%d', [*alarm_names]))
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']}))
end
request({
'Action' => 'DescribeAlarms',
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarms.new
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarmsForMetric.new
}.merge(options))
end
end
@ -38,3 +39,4 @@ module Fog
end
end