Sha256: 709e69a546b6910167aa0801b2db2c115eda4cffc866beb376d4a4d1c6c4599f

Contents?: true

Size: 1.43 KB

Versions: 16

Compression:

Stored size: 1.43 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
          put_opts.merge!('Timestamp' => dimensions) if timestamp
          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

16 entries across 16 versions & 4 rubygems

Version Path
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog_tractical-1.1.4 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog_tractical-1.1.3 lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.1.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.1.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
tag-fog-1.0.1 lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-1.0.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-0.11.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb
fog-0.10.0 lib/fog/aws/models/cloud_watch/metric_statistic.rb