diff --git a/lib/fog/aws/requests/cloud_watch/describe_alarms.rb b/lib/fog/aws/requests/cloud_watch/describe_alarms.rb index 8100fa18a..6e416fcb6 100644 --- a/lib/fog/aws/requests/cloud_watch/describe_alarms.rb +++ b/lib/fog/aws/requests/cloud_watch/describe_alarms.rb @@ -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 \ No newline at end of file diff --git a/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb b/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb index 43e7d0291..265f8c249 100644 --- a/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb +++ b/lib/fog/aws/requests/cloud_watch/describe_alarms_for_metric.rb @@ -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 +