diff --git a/lib/fog/aws/cloud_watch.rb b/lib/fog/aws/cloud_watch.rb index c14a98478..c9250e06c 100644 --- a/lib/fog/aws/cloud_watch.rb +++ b/lib/fog/aws/cloud_watch.rb @@ -17,6 +17,7 @@ module Fog request :enable_alarm_actions request :disable_alarm_actions request :describe_alarms_for_metric + request :set_alarm_state model_path 'fog/aws/models/cloud_watch' model :metric diff --git a/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb b/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb new file mode 100644 index 000000000..f6482d15f --- /dev/null +++ b/lib/fog/aws/parsers/cloud_watch/set_alarm_state.rb @@ -0,0 +1,26 @@ +module Fog + module Parsers + module AWS + module CloudWatch + + class SetAlarmState < 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/set_alarm_state.rb b/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb new file mode 100644 index 000000000..6237276ef --- /dev/null +++ b/lib/fog/aws/requests/cloud_watch/set_alarm_state.rb @@ -0,0 +1,31 @@ +module Fog + module AWS + class CloudWatch + class Real + + require 'fog/aws/parsers/cloud_watch/set_alarm_state' + + # Temporarily sets the state of an alarm + # ==== Options + # * AlarmName<~String>: The names of the alarm + # * StateReason<~String>: The reason that this alarm is set to this specific state (in human-readable text format) + # * StateReasonData<~String>: The reason that this alarm is set to this specific state (in machine-readable JSON format) + # * StateValue<~String>: The value of the state + # + # ==== Returns + # * response<~Excon::Response>: + # + # ==== See Also + # http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_SetAlarmState.html + # + + def set_alarm_state(options) + request({ + 'Action' => 'SetAlarmState', + :parser => Fog::Parsers::AWS::CloudWatch::SetAlarmState.new + }.merge(options)) + end + end + end + end +end \ No newline at end of file