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(override = nil) ⇒ Object



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

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