Class: Fog::AWS::CloudWatch::MetricStatistic

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

Instance Method Summary collapse

Instance Method Details

#saveObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/aws/models/cloud_watch/metric_statistic.rb', line 20

def save
  requires :metric_name
  requires :namespace
  requires :unit

  put_opts = {'MetricName' => metric_name, 'Unit' => unit}
  put_opts.merge!('Dimensions' => dimensions) if dimensions
  if value
    put_opts.merge!('Value' => value)
  else
    put_opts.merge!('StatisticValues' => {
      'Minimum' => minimum,
      'Maximum' => maximum,
      'Sum' => sum,
      'Average' => average,
      'SampleCount' => sample_count
    })
  end
  service.put_metric_data(namespace, [put_opts])
  true
end