Sha256: 75de478cbd693e76ee0e6b8892420caa6bf38fbcda98341907097a5fe9ec00f6

Contents?: true

Size: 1.37 KB

Versions: 26

Compression:

Stored size: 1.37 KB

Contents

require 'fog/core/model'

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
          connection.put_metric_data(namespace, [put_opts])
          true
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 11 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-test-again-1.6.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.8.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.7.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.6.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.5.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.4.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
michiels-fog-1.3.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.3.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.3.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb