Class: Fog::AWS::CloudWatch::Alarm

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/cloud_watch/alarm.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Alarm

Returns a new instance of Alarm.



28
29
30
31
32
# File 'lib/fog/aws/models/cloud_watch/alarm.rb', line 28

def initialize(attributes)
  self.namespace ||= "AWS/EC2"
  self.evaluation_periods ||= 1
  super
end

Instance Method Details

#destroyObject



52
53
54
55
# File 'lib/fog/aws/models/cloud_watch/alarm.rb', line 52

def destroy
  requires :id
  service.delete_alarms(id)
end

#saveObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fog/aws/models/cloud_watch/alarm.rb', line 34

def save
  requires :id
  requires :comparison_operator
  requires :metric_name
  requires :period
  requires :statistic
  requires :threshold
  requires :namespace
  requires :evaluation_periods


  options = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]
  options.delete_if { |key, value| value.nil? }

  service.put_metric_alarm(options)
  reload
end