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

adding describe_alarm_history

This commit is contained in:
Michael Zeng 2011-09-29 18:18:58 -04:00
parent 76b88bdb69
commit 0af87e09cc
4 changed files with 74 additions and 0 deletions

View file

@ -14,6 +14,7 @@ module Fog
request :describe_alarms
request :put_metric_alarm
request :delete_alarms
request :describe_alarm_history
model_path 'fog/aws/models/cloud_watch'
model :metric

View file

@ -0,0 +1,36 @@
module Fog
module Parsers
module AWS
module CloudWatch
class DescribeAlarmHistory < Fog::Parsers::Base
def reset
@response = { 'DescribeAlarmHistoryResult' => {'AlarmHistory' => []}, 'ResponseMetadata' => {} }
reset_alarm_history
end
def reset_alarm_history
@alarm_history = {}
end
def start_element(name, attrs = [])
super
end
def end_element(name)
@dimension[name] = value
case name
#when 'Name', 'Value'
#@dimension[name] = value
when 'RequestId'
@response['ResponseMetadata'][name] = value
when 'member'
@response['DescribeAlarmHistoryResult']['AlarmHistory'] << @metric_alarms
end
end
end
end
end
end
end

View file

@ -0,0 +1,36 @@
module Fog
module AWS
class CloudWatch
class Real
require 'fog/aws/parsers/cloud_watch/describe_alarm_history'
# Retrieves history for the specified alarm
# ==== Options
# * AlarmName<~String>: The name of the alarm
# * EndDate<~DateTime>: The ending date to retrieve alarm history
# * HistoryItemType<~String>: The type of alarm histories to retrieve
# * MaxRecords<~Integer>: The maximum number of alarm history records to retrieve
# * NextToken<~String> The token returned by a previous call to indicate that there is more data available
# * StartData<~DateTime>: The starting date to retrieve alarm history
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/index.html?API_DescribeAlarmHistory.html
#
def describe_alarm_history(options={})
request({
'Action' => 'DescribeAlarmHistory',
:parser => Fog::Parsers::AWS::CloudWatch::DescribeAlarmHistory.new
}.merge(options))
end
end
end
end
end

View file

@ -14,6 +14,7 @@ module Fog
# * 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