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

[aws|cloudwatch] Add support for put-metric-alarm call.

This commit is contained in:
Jens Braeuer 2011-10-03 12:05:53 +02:00
parent 9bf5c15a81
commit 40f8f45c32
3 changed files with 15 additions and 4 deletions

View file

@ -13,6 +13,7 @@ module Fog
request :list_metrics
request :get_metric_statistics
request :put_metric_data
<<<<<<< HEAD
request :describe_alarms
request :put_metric_alarm
request :delete_alarms
@ -21,6 +22,9 @@ module Fog
request :disable_alarm_actions
request :describe_alarms_for_metric
request :set_alarm_state
=======
request :put_metric_alarm
>>>>>>> [aws|cloudwatch] Add support for put-metric-alarm call.
model_path 'fog/aws/models/cloud_watch'
model :metric

View file

@ -15,11 +15,19 @@ module Fog
def end_element(name)
case name
<<<<<<< HEAD
when 'RequestId'
@response['ResponseMetadata'][name] = value
end
end
end
=======
when /RequestId|PutMetricAlarmResponse/
@response['ResponseMetadata'][name] = @value.strip
end
end
end
>>>>>>> [aws|cloudwatch] Add support for put-metric-alarm call.
end
end
end

View file

@ -1,8 +1,7 @@
module Fog
module AWS
class CloudWatch
class Real
class Real
require 'fog/aws/parsers/cloud_watch/put_metric_alarm'
# Creates or updates an alarm and associates it with the specified Amazon CloudWatch metric
@ -31,7 +30,6 @@ module Fog
# ==== See Also
# http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_PutMetricAlarm.html
#
def put_metric_alarm(options)
if dimensions = options.delete('Dimensions')
options.merge!(AWS.indexed_param('Dimensions.member.%d.Name', dimensions.collect {|dimension| dimension['Name']}))
@ -46,12 +44,13 @@ module Fog
if ok_actions = options.delete('OKActions')
options.merge!(AWS.indexed_param('OKActions.member.%d', [*ok_actions]))
end
request({
'Action' => 'PutMetricAlarm',
:parser => Fog::Parsers::AWS::CloudWatch::PutMetricAlarm.new
}.merge(options))
end
end
end
end
end
end