Class: Fog::AWS::CloudWatch::Alarms
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::AWS::CloudWatch::Alarms
- Defined in:
- lib/fog/aws/models/cloud_watch/alarms.rb
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
- #all ⇒ Object
-
#delete(alarm_names) ⇒ Object
alarm_names is an array of alarm names.
- #disable(alarm_names) ⇒ Object
- #enable(alarm_names) ⇒ Object
- #get(identity) ⇒ Object
Methods inherited from Collection
#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json
Methods included from Fog::Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Method Details
#all ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 11 def all data = [] next_token = nil loop do result = connection.describe_alarms('NextToken' => next_token).body['DescribeAlarmsResult'] data += result['MetricAlarms'] next_token = result['NextToken'] break if next_token.nil? end load(data) end |
#delete(alarm_names) ⇒ Object
alarm_names is an array of alarm names
29 30 31 32 |
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 29 def delete(alarm_names) connection.delete_alarms(alarm_names) true end |
#disable(alarm_names) ⇒ Object
34 35 36 37 |
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 34 def disable(alarm_names) connection.disable_alarm_actions(alarm_names) true end |
#enable(alarm_names) ⇒ Object
39 40 41 42 |
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 39 def enable(alarm_names) connection.enable_alarm_actions(alarm_names) true end |
#get(identity) ⇒ Object
23 24 25 26 |
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 23 def get(identity) data = connection.describe_alarms('AlarmNames' => identity).body['DescribeAlarmsResult']['MetricAlarms'].first new(data) unless data.nil? end |