Module: CpOraclecloud::DatabaseMixin

Included in:
DatabaseComponent, DatabaseInstance
Defined in:
lib/cp_oraclecloud/database_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
25
26
# File 'lib/cp_oraclecloud/database_mixin.rb', line 3

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