Sha256: 7721b0dd637904df6ea0f24d4dad99309782e2b253155d94348fa1c56c7ec218

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'aws/rikanjo/ec2'
require 'aws/rikanjo/rds'
require 'aws/rikanjo/calc'

module Aws
  module RiKanjoo
    class Base < Calc
      attr_reader :region, :instance_type, :ri_util, :multiaz

      def initialize(mode = 'ec2', region, instance_type, ri_util, multiaz)
        if mode == 'ec2'
          @mode = Aws::RiKanjoo::Ec2.new(region, instance_type, ri_util)
        elsif mode == 'rds'
          @mode = Aws::RiKanjoo::Rds.new(region, instance_type, ri_util, multiaz)
        end
        @region        = region
        @instance_type = instance_type
        @ri_util       = ri_util
        @om_info       = {}
        @ri_info       = {}
      end
    end
  end
end

# m = Aws::RiKanjoo.new(region = "ap-northeast-1", instance_type = "m3.large", ri_util = "medium")
# m.total_cost_year
#
#  "region" : ap-northeast-1
#  "instance_type" : m3.large
#  "ri_util" : medium
#  "discont percent (percent)" : 35.09
#  "ondemand hour price (doller)" : 0.203
#  "reserved hour price (doller)" : 0.086
#  "ondemand year price (doller)" : 1778.28
#  "reserved year price (doller)" : 1154.36
#  "reserved upfront (doller)" : 401
#  "sweet spot day (day)" : 142
#  "sweet spot date (date)" : 2014-09-19
#  "sweet spot price (doller)" : 696.15

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws-rikanjo-0.0.9 lib/aws/rikanjo/base.rb