Class: Fog::AWS::CloudWatch::Mock
- Inherits:
-
Object
- Object
- Fog::AWS::CloudWatch::Mock
- Defined in:
- lib/rackspace-fog/aws/cloud_watch.rb,
lib/rackspace-fog/aws/requests/cloud_watch/put_metric_alarm.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Mock
constructor
A new instance of Mock.
-
#put_metric_alarm(options) ⇒ Object
See: Fog::AWS::CloudWatch::Real.put_metric_alarm().
Constructor Details
#initialize(options = {}) ⇒ Mock
Returns a new instance of Mock.
39 40 |
# File 'lib/rackspace-fog/aws/cloud_watch.rb', line 39 def initialize(={}) end |
Instance Method Details
#put_metric_alarm(options) ⇒ Object
See: Fog::AWS::CloudWatch::Real.put_metric_alarm()
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rackspace-fog/aws/requests/cloud_watch/put_metric_alarm.rb', line 60 def put_metric_alarm() supported_actions = [ "InsufficientDataActions", "OKActions", "AlarmActions" ] found_actions = .keys.select {|key| supported_actions.include? key } if found_actions.empty? raise Fog::Compute::AWS::Error.new("The request must contain at least one of #{supported_actions.join(", ")}'") end requirements = [ "AlarmName", "ComparisonOperator", "EvaluationPeriods", "Namespace", "Period", "Statistic", "Threshold" ] requirements.each do |req| unless .has_key?(req) raise Fog::Compute::AWS::Error.new("The request must contain a the parameter '%s'" % req) end end response = Excon::Response.new response.status = 200 response.body = { 'requestId' => Fog::AWS::Mock.request_id } response end |