class Fog::AWS::CloudWatch::AlarmData
Public Instance Methods
all(conditions={})
click to toggle source
# File lib/fog/aws/models/cloud_watch/alarm_data.rb, line 9 def all(conditions={}) data = service.describe_alarms(conditions).body['DescribeAlarmsResult']['MetricAlarms'] load(data) # data is an array of attribute hashes end
get(namespace, metric_name, dimensions=nil, period=nil, statistic=nil, unit=nil)
click to toggle source
# File lib/fog/aws/models/cloud_watch/alarm_data.rb, line 14 def get(namespace, metric_name, dimensions=nil, period=nil, statistic=nil, unit=nil) list_opts = {'Namespace' => namespace, 'MetricName' => metric_name} if dimensions dimensions_array = dimensions.map do |name, value| {'Name' => name, 'Value' => value} end list_opts.merge!('Dimensions' => dimensions_array) end if period list_opts.merge!('Period' => period) end if statistic list_opts.merge!('Statistic' => statistic) end if unit list_opts.merge!('Unit' => unit) end data = service.describe_alarms_for_metric(list_opts).body['DescribeAlarmsForMetricResult']['MetricAlarms'] load(data) end