Module: CpOraclecloud::JavaMixin

Included in:
JavaComponent, JavaInstance
Defined in:
lib/cp_oraclecloud/java_mixin.rb

Instance Method Summary collapse

Instance Method Details

#calculate_monthly_cost(config) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cp_oraclecloud/java_mixin.rb', line 3

def calculate_monthly_cost(config)
  if %w(oc3 oc4 oc5 oc6).include? config['shape'] 
    # General Compute
    rates = CpOraclecloud.rate_card[:java]['general']
   else 
    # High Memory
    rates = CpOraclecloud.rate_card[:java]['high']
   end
   case config['edition']
   when 'SE'
    edition_rate = rates['standard']
   when 'EE'
    edition_rate = rates['enterprise']
   when 'Suite'
    edition_rate = rates['suite']
   end
   if config['subscription_type'] == 'MONTHLY' then cost = edition_rate['monthly']
   else cost = 30 * 24 * edition_rate['hourly'] end
   cost = cost * config['num_nodes'].to_f
   cost
end