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
data[:metric_alarms][options['AlarmName']] = {
'AlarmARN' => "arn:aws:cloudwatch:eu-west-1:000000000000:metricAlarm:00000000-0000-0000-0000-000000000000:alarmName/#{options['AlarmName']}",
'ActionsEnabled' => false,
'AlarmActions' => [],
'AlarmConfigurationUpdatedTimestamp' => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ"),
'Dimensions' => [],
'OKActions' => [],
}.merge!(options)
response = Excon::Response.new
response.status = 200
response.body = {
'requestId' => Fog::AWS::Mock.request_id
}
response
end