1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|cloud_watch] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:31:48 +00:00
parent 4dd40c1c70
commit b42d4731e5
8 changed files with 28 additions and 28 deletions

View file

@ -46,13 +46,13 @@ module Fog
options = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]
options.delete_if { |key, value| value.nil? }
connection.put_metric_alarm(options)
service.put_metric_alarm(options)
reload
end
def destroy
requires :id
connection.delete_alarms(id)
service.delete_alarms(id)
end
end
end

View file

@ -8,7 +8,7 @@ module Fog
model Fog::AWS::CloudWatch::AlarmDatum
def all(conditions={})
data = connection.describe_alarms(conditions).body['DescribeAlarmsResult']['MetricAlarms']
data = service.describe_alarms(conditions).body['DescribeAlarmsResult']['MetricAlarms']
load(data) # data is an array of attribute hashes
end
@ -29,7 +29,7 @@ module Fog
if unit
list_opts.merge!('Unit' => unit)
end
data = connection.describe_alarms_for_metric(list_opts).body['DescribeAlarmsForMetricResult']['MetricAlarms']
data = service.describe_alarms_for_metric(list_opts).body['DescribeAlarmsForMetricResult']['MetricAlarms']
load(data)
end

View file

@ -57,7 +57,7 @@ module Fog
alarm_definition.merge!('OKActions' => ok_actions) if ok_actions
alarm_definition.merge!('Unit' => unit) if unit
connection.put_metric_alarm(alarm_definition)
service.put_metric_alarm(alarm_definition)
true
end
end

View file

@ -8,7 +8,7 @@ module Fog
model Fog::AWS::CloudWatch::AlarmHistory
def all(conditions={})
data = connection.describe_alarm_history(conditions).body['DescribeAlarmHistoryResult']['AlarmHistoryItems']
data = service.describe_alarm_history(conditions).body['DescribeAlarmHistoryResult']['AlarmHistoryItems']
load(data) # data is an array of attribute hashes
end

View file

@ -12,7 +12,7 @@ module Fog
data = []
next_token = nil
loop do
result = connection.describe_alarms('NextToken' => next_token).body['DescribeAlarmsResult']
result = service.describe_alarms('NextToken' => next_token).body['DescribeAlarmsResult']
data += result['MetricAlarms']
next_token = result['NextToken']
break if next_token.nil?
@ -21,23 +21,23 @@ module Fog
end
def get(identity)
data = connection.describe_alarms('AlarmNames' => identity).body['DescribeAlarmsResult']['MetricAlarms'].first
data = service.describe_alarms('AlarmNames' => identity).body['DescribeAlarmsResult']['MetricAlarms'].first
new(data) unless data.nil?
end
#alarm_names is an array of alarm names
def delete(alarm_names)
connection.delete_alarms(alarm_names)
service.delete_alarms(alarm_names)
true
end
def disable(alarm_names)
connection.disable_alarm_actions(alarm_names)
service.disable_alarm_actions(alarm_names)
true
end
def enable(alarm_names)
connection.enable_alarm_actions(alarm_names)
service.enable_alarm_actions(alarm_names)
true
end

View file

@ -36,7 +36,7 @@ module Fog
'SampleCount' => sample_count
})
end
connection.put_metric_data(namespace, [put_opts])
service.put_metric_data(namespace, [put_opts])
true
end
end

View file

@ -12,7 +12,7 @@ module Fog
namespace = conditions['Namespace']
dimensions = conditions['Dimensions']
get_metric_opts = {"StartTime" => (Time.now-3600).iso8601, "EndTime" => Time.now.iso8601, "Period" => 300}.merge(conditions)
data = connection.get_metric_statistics(get_metric_opts).body['GetMetricStatisticsResult']['Datapoints']
data = service.get_metric_statistics(get_metric_opts).body['GetMetricStatisticsResult']['Datapoints']
data.collect! { |datum| datum.merge('MetricName' => metricName, 'Namespace' => namespace, 'Dimensions' => dimensions) }
load(data) # data is an array of attribute hashes
end

View file

@ -11,7 +11,7 @@ module Fog
model Fog::AWS::CloudWatch::Metric
def all(conditions={})
result = connection.list_metrics(conditions).body['ListMetricsResult']
result = service.list_metrics(conditions).body['ListMetricsResult']
merge_attributes("NextToken" => result["NextToken"])
load(result['Metrics']) # an array of attribute hashes
end
@ -41,7 +41,7 @@ module Fog
end
# list_opts.merge!('Dimensions' => dimensions_array)
end
if data = connection.list_metrics(list_opts).body['ListMetricsResult']['Metrics'].first
if data = service.list_metrics(list_opts).body['ListMetricsResult']['Metrics'].first
new(data)
end
end