diff --git a/lib/fog/aws/cloud_watch.rb b/lib/fog/aws/cloud_watch.rb index db1401b6f..5be312c0b 100644 --- a/lib/fog/aws/cloud_watch.rb +++ b/lib/fog/aws/cloud_watch.rb @@ -15,6 +15,8 @@ module Fog request :put_metric_alarm request :delete_alarms request :describe_alarm_history + request :enable_alarm_actions + request :disable_alarm_actions model_path 'fog/aws/models/cloud_watch' model :metric diff --git a/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb b/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb new file mode 100644 index 000000000..ee8884ee9 --- /dev/null +++ b/lib/fog/aws/parsers/cloud_watch/disable_alarm_actions.rb @@ -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 \ No newline at end of file diff --git a/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb b/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb new file mode 100644 index 000000000..c166ab26b --- /dev/null +++ b/lib/fog/aws/parsers/cloud_watch/enable_alarm_actions.rb @@ -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 \ No newline at end of file diff --git a/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb b/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb new file mode 100644 index 000000000..2bd9aea20 --- /dev/null +++ b/lib/fog/aws/requests/cloud_watch/disable_alarm_actions.rb @@ -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 + diff --git a/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb b/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb new file mode 100644 index 000000000..f880abca5 --- /dev/null +++ b/lib/fog/aws/requests/cloud_watch/enable_alarm_actions.rb @@ -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 +