Class: Fog::AWS::CloudWatch::Alarms

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

Instance Method Summary collapse

Instance Method Details

#allObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 9

def all
  data = []
  next_token = nil
  loop do
    body = service.describe_alarms('NextToken' => next_token).body
    data += body['DescribeAlarmsResult']['MetricAlarms']
    next_token = body['ResponseMetadata']['NextToken']
    break if next_token.nil?
  end
  load(data)
end

#delete(alarm_names) ⇒ Object

alarm_names is an array of alarm names



27
28
29
30
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 27

def delete(alarm_names)
  service.delete_alarms(alarm_names)
  true
end

#disable(alarm_names) ⇒ Object



32
33
34
35
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 32

def disable(alarm_names)
  service.disable_alarm_actions(alarm_names)
  true
end

#enable(alarm_names) ⇒ Object



37
38
39
40
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 37

def enable(alarm_names)
  service.enable_alarm_actions(alarm_names)
  true
end

#get(identity) ⇒ Object



21
22
23
24
# File 'lib/fog/aws/models/cloud_watch/alarms.rb', line 21

def get(identity)
  data = service.describe_alarms('AlarmNames' => identity).body['DescribeAlarmsResult']['MetricAlarms'].first
  new(data) unless data.nil?
end