From 40f8f45c325755ede98031353841cd1f34473eed Mon Sep 17 00:00:00 2001 From: Jens Braeuer Date: Mon, 3 Oct 2011 12:05:53 +0200 Subject: [PATCH] [aws|cloudwatch] Add support for put-metric-alarm call. --- lib/fog/aws/cloud_watch.rb | 4 ++++ lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb | 8 ++++++++ lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb | 7 +++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/fog/aws/cloud_watch.rb b/lib/fog/aws/cloud_watch.rb index a1dd9c12f..6b33b5279 100644 --- a/lib/fog/aws/cloud_watch.rb +++ b/lib/fog/aws/cloud_watch.rb @@ -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 diff --git a/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb b/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb index 2fa3a2bdf..dd560fda1 100644 --- a/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb +++ b/lib/fog/aws/parsers/cloud_watch/put_metric_alarm.rb @@ -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 diff --git a/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb b/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb index 8e16992e1..8d3b2b9be 100644 --- a/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +++ b/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb @@ -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