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

adding diable/enable alarm actions

This commit is contained in:
Michael Zeng 2011-09-29 18:46:15 -04:00
parent 0af87e09cc
commit 519376f635
5 changed files with 116 additions and 0 deletions

View file

@ -15,6 +15,8 @@ module Fog
request :put_metric_alarm request :put_metric_alarm
request :delete_alarms request :delete_alarms
request :describe_alarm_history request :describe_alarm_history
request :enable_alarm_actions
request :disable_alarm_actions
model_path 'fog/aws/models/cloud_watch' model_path 'fog/aws/models/cloud_watch'
model :metric model :metric

View file

@ -0,0 +1,24 @@
module Fog
module Parsers
module AWS
module CloudWatch
class DisableAlarmActions < Fog::Parsers::Base
def reset
@response = { 'ResponseMetadata' => {} }
end
def start_element(name, attrs = [])
super
end
def end_element(name)
case name
when 'RequestId'
@response['ResponseMetadata'][name] = value
end
end
end
end
end
end
end

View file

@ -0,0 +1,24 @@
module Fog
module Parsers
module AWS
module CloudWatch
class EnableAlarmActions < Fog::Parsers::Base
def reset
@response = { 'ResponseMetadata' => {} }
end
def start_element(name, attrs = [])
super
end
def end_element(name)
case name
when 'RequestId'
@response['ResponseMetadata'][name] = value
end
end
end
end
end
end
end

View file

@ -0,0 +1,33 @@
module Fog
module AWS
class CloudWatch
class Real
require 'fog/aws/parsers/cloud_watch/disable_alarm_actions'
# Disables actions for the specified alarms
# StartTime is capped to 2 weeks ago
# ==== Options
# * AlarmNames<~Array>: The names of the alarms to disable actions for
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_DisableAlarmActions.html
#
def disable_alarm_actions(alarms)
options = {}
options.merge!(AWS.indexed_param('AlarmNames.member.%d', [*alarms]))
request({
'Action' => 'DisableAlarmActions',
:parser => Fog::Parsers::AWS::CloudWatch::DisableAlarmActions.new
}.merge(options))
end
end
end
end
end

View file

@ -0,0 +1,33 @@
module Fog
module AWS
class CloudWatch
class Real
require 'fog/aws/parsers/cloud_watch/enable_alarm_actions'
# Enables actions for the specified alarms
# StartTime is capped to 2 weeks ago
# ==== Options
# * AlarmNames<~Array>: The names of the alarms to enable actions for
#
# ==== Returns
# * response<~Excon::Response>:
#
# ==== See Also
# http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_EnableAlarmActions.html
#
def enable_alarm_actions(alarms)
options = {}
options.merge!(AWS.indexed_param('AlarmNames.member.%d', [*alarms]))
request({
'Action' => 'EnableAlarmActions',
:parser => Fog::Parsers::AWS::CloudWatch::EnableAlarmActions.new
}.merge(options))
end
end
end
end
end