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



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

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



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

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

#disable(alarm_names) ⇒ Object



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

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

#enable(alarm_names) ⇒ Object



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

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

#get(identity) ⇒ Object



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

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