Sha256: 76a9b312f5606c14ac9f88b119c6f73e75b054b826d11e7534e65578eb20524b

Contents?: true

Size: 1.33 KB

Versions: 75

Compression:

Stored size: 1.33 KB

Contents

module Fog
  module AWS
    class CloudWatch
      class MetricStatistic < Fog::Model
        attribute :label, :aliases => 'Label'
        attribute :minimum, :aliases => 'Minimum'
        attribute :maximum, :aliases => 'Maximum'
        attribute :sum, :aliases => 'Sum'
        attribute :average, :aliases => 'Average'
        attribute :sample_count, :aliases => 'SampleCount'
        attribute :timestamp, :aliases => 'Timestamp'
        attribute :unit, :aliases => 'Unit'
        attribute :metric_name, :aliases => 'MetricName'
        attribute :namespace, :aliases => 'Namespace'
        attribute :dimensions, :aliases => 'Dimensions'
        attribute :value

        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
      end
    end
  end
end

Version data entries

75 entries across 73 versions & 3 rubygems

Version Path
fog-aws-3.29.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.28.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.27.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.26.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.25.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.24.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.23.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.22.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.21.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.21.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.20.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.19.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.18.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.17.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.16.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.15.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.14.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.13.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.12.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-3.11.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb