Class: Fog::AWS::CloudWatch::Alarm
- Defined in:
- lib/fog/aws/models/cloud_watch/alarm.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Alarm
constructor
A new instance of Alarm.
- #save ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Fog::Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Fog::Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Alarm
Returns a new instance of Alarm.
30 31 32 33 34 |
# File 'lib/fog/aws/models/cloud_watch/alarm.rb', line 30 def initialize(attributes) attributes['EvaluationPeriods'] ||= 1 attributes['Namespace'] ||= 'AWS/EC2' super end |
Instance Method Details
#destroy ⇒ Object
53 54 55 56 |
# File 'lib/fog/aws/models/cloud_watch/alarm.rb', line 53 def destroy requires :id service.delete_alarms(id) end |
#save ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/aws/models/cloud_watch/alarm.rb', line 36 def save requires :id requires :comparison_operator requires :evaluation_periods requires :metric_name requires :namespace requires :period requires :statistic requires :threshold = Hash[self.class.aliases.map { |key, value| [key, send(value)] }] .delete_if { |key, value| value.nil? } service.put_metric_alarm() reload end |