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

bug fixes

This commit is contained in:
Michael Zeng 2011-10-03 16:18:45 -04:00
parent 4c524be0f0
commit 9c55b55111
9 changed files with 29 additions and 20 deletions

View file

@ -7,7 +7,7 @@ Gem::Specification.new do |s|
## the sub! line in the Rakefile
s.name = 'fog'
s.version = '0.11.0'
s.date = '2011-09-30'
s.date = '2011-10-03'
s.rubyforge_project = 'fog'
## Make sure your summary is short. The description may be as long

View file

@ -24,6 +24,12 @@ module Fog
collection :metrics
model :metric_statistic
collection :metric_statistics
model :alarm_datum
collection :alarm_data
model :alarm_history
collection :alarm_histories
model :alarm
collection :alarms
class Mock

View file

@ -15,7 +15,7 @@ module Fog
attribute :statistic, :aliases => 'Statistic'
attribute :comparison_operator, :aliases => 'ComparisonOperator'
attribute :state_reason, :aliases => 'StateReason'
attribute :action_enabled. :aliases => 'ActionsEnabled'
attribute :action_enabled, :aliases => 'ActionsEnabled'
attribute :period, :aliases => 'Period'
attribute :evaluation_periods, :aliases => 'EvaluationPeriods'
attribute :threshold, :aliases => 'Threshold'
@ -51,7 +51,7 @@ module Fog
alarm_definition.merge!('AlarmActions' => alarm_actions) if alarm_actions
alarm_definition.merge!('AlarmDescription' => alarm_description) if alarm_description
#dimension is an array of Name/Value pairs, ex. ['host'=>'fog-host', 'version'=>'0.11.0']
#dimension is an array of Name/Value pairs, ex. [{'Name'=>'host', 'Value'=>'localhost'},{'Name'=>'version', 'Value'=>'0.11.0'}]
alarm_definition.merge!('Dimensions' => dimensions) if dimensions
alarm_definition.merge!('InsufficientDataActions' => insufficient_actions) if insufficient_actions
alarm_definition.merge!('OKActions' => ok_actions) if ok_actions

View file

@ -10,7 +10,6 @@ module Fog
attribute :history_item_type, :aliases => 'HistoryItemType'
attribute :max_records, :aliases => 'MaxRecords'
attribute :start_date, :aliases => 'StartDate'
end
end
end

View file

@ -19,7 +19,7 @@ module Fog
@response['ResponseMetadata'][name] = @value
end
end
end
end
end
end
end

View file

@ -10,7 +10,7 @@ module Fog
reset_alarm_history_item
end
def reset_alarm_history
def reset_alarm_history_item
@alarm_history_item = {}
end

View file

@ -42,7 +42,7 @@ module Fog
@metric_alarms[name] = value.to_f
when 'AlarmActions', 'OKActions', 'InsufficientDataActions'
@metric_alarms[name] = value.to_s.strip
when 'AlarmName', 'Namespace', 'MetricName', 'AlarmDescription', 'AlarmArn', 'Unit'
when 'AlarmName', 'Namespace', 'MetricName', 'AlarmDescription', 'AlarmArn', 'Unit',
'StateValue', 'Statistic', 'ComparisonOperator', 'StateReason', 'ActionsEnabled'
@metric_alarms[name] = value
when 'StateUpdatedTimestamp', 'AlarmConfigurationUpdatedTimestamp'
@ -55,13 +55,11 @@ module Fog
@response['ResponseMetadata'][name] = value
when 'member'
if !@in_dimensions
unless @metric_alarms == {}
if @metric_alarms.has_key?('AlarmName')
@response['DescribeAlarmsResult']['MetricAlarms'] << @metric_alarms
else
@response['DescribeAlarmsResult']['MetricAlarms'].last.merge!( @metric_alarms)
reset_metric_alarms
end
if @metric_alarms.has_key?('AlarmName')
@response['DescribeAlarmsResult']['MetricAlarms'] << @metric_alarms
reset_metric_alarms
elsif @response['DescribeAlarmsResult']['MetricAlarms'].last != nil
@response['DescribeAlarmsResult']['MetricAlarms'].last.merge!( @metric_alarms)
end
else
@metric_alarms['Dimensions'] << @dimension

View file

@ -40,22 +40,28 @@ module Fog
@metric_alarms[name] = value.to_f
when 'AlarmActions', 'OKActions', 'InsufficientDataActions'
@metric_alarms[name] = value.to_s.strip
when 'AlarmName', 'Namespace', 'MetricName', 'AlarmDescription', 'AlarmArn', 'Unit'
when 'AlarmName', 'Namespace', 'MetricName', 'AlarmDescription', 'AlarmArn', 'Unit',
'StateValue', 'Statistic', 'ComparisonOperator', 'StateReason', 'ActionsEnabled'
@metric_alarms[name] = value
when 'StateUpdatedTimestamp', 'AlarmConfigurationUpdatedTimestamp'
@metric_alarms[name] = Time.parse value
when 'Dimensions'
@in_dimensions = false
when 'NextToken'
@response['ResponseMetadata'][name] = value
when 'RequestId'
@response['ResponseMetadata'][name] = value
@response['ResponseMetadata'][name] = value
when 'member'
if !@in_dimensions
@response['DescribeAlarmsForMetricResult']['MetricAlarms'] << @metric_alarms
reset_metric_alarms
if @metric_alarms.has_key?('AlarmName')
@response['DescribeAlarmsForMetricResult']['MetricAlarms'] << @metric_alarms
reset_metric_alarms
elsif @response['DescribeAlarmsForMetricResult']['MetricAlarms'].last != nil
@response['DescribeAlarmsForMetricResult']['MetricAlarms'].last.merge!( @metric_alarms)
end
else
@metric_alarms['Dimensions'] << @dimension
end
end
end
end
end

View file

@ -29,7 +29,7 @@ module Fog
options.merge!(AWS.indexed_param('Dimensions.member.%d.Value', dimensions.collect {|dimension| dimension['Value']}))
end
request({
'Action' => 'DescribeAlarms',
'Action' => 'DescribeAlarmsForMetric',
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarmsForMetric.new
}.merge(options))
end