class Fog::AWS::CloudWatch::Mock

Public Class Methods

new(options={}) click to toggle source
# File lib/fog/aws/cloud_watch.rb, line 39
def initialize(options={})
end

Public Instance Methods

put_metric_alarm(options) click to toggle source

See: Fog::AWS::CloudWatch::Real#put_metric_alarm

# File lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb, line 60
def put_metric_alarm(options)
  supported_actions = [ "InsufficientDataActions", "OKActions", "AlarmActions" ]
  found_actions = options.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 options.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