Sha256: 2d065442c4e937fb90c50301b89658e3e1eb4d48bf298798a6dfd62bab190740

Contents?: true

Size: 1.36 KB

Versions: 22

Compression:

Stored size: 1.36 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
          service.put_metric_data(namespace, [put_opts])
          true
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-0.1.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-0.1.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-0.0.8 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-0.0.7 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-0.0.6 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-aws-0.0.5 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.26.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.25.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
nsidc-fog-1.24.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.24.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.11 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.10 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.9 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.8 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.7 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.6 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.23.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.4 lib/fog/aws/models/cloud_watch/metric_statistic.rb
ns-fog-1.22.3 lib/fog/aws/models/cloud_watch/metric_statistic.rb