Class: CpOraclecloud::JavaComponent

Inherits:
CloudComponent
  • Object
show all
Includes:
JavaMixin
Defined in:
app/models/cp_oraclecloud/java_component.rb

Instance Method Summary collapse

Methods included from JavaMixin

#calculate_monthly_cost

Instance Method Details

#admin_password_complexityObject



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/models/cp_oraclecloud/java_component.rb', line 46

def admin_password_complexity
  if admin_password.size < 8 or admin_password.size > 30
    errors.add :admin_password, "Must be at betweeen 8 and 30 characters long."
  end
  if !(admin_password[0] =~ /[[:alpha:]]/)
    errors.add :admin_password, "First character must be a letter"
  end
  if (admin_password =~ /[a-z]/).blank? then errors.add :admin_password, 'Must contain a lower case letter' end
  if (admin_password =~ /[A-Z]/).blank? then errors.add :admin_password, 'Must contain an upper case letter' end
  if (admin_password =~ /[0-9]/).blank? then errors.add :admin_password, 'Must contain atleast one number' end
  if (admin_password =~ /[-_#$]/).blank? then errors.add :admin_password, 'Must contain a special character (-, _, #, $)' end

end

#domain_partition_correctObject



42
43
44
# File 'app/models/cp_oraclecloud/java_component.rb', line 42

def domain_partition_correct
  if ![0,1,2,4].include?(domain_partition_count.to_i) then errors.add :domain_partition_count, "Invalid Domain Partition Count" end
end

#initObject



29
30
31
32
33
34
35
36
# File 'app/models/cp_oraclecloud/java_component.rb', line 29

def init
  self.enable_admin_console ||= true
  self.provision_otd ||= true
  self.level ||= 'PAAS'
  self.subscription_type ||= 'HOURLY'
  self.edition ||= 'EE'
  self.num_nodes ||= 1
end

#instance_nameObject



74
75
76
# File 'app/models/cp_oraclecloud/java_component.rb', line 74

def instance_name
  "service_name"
end

#instance_typeObject



70
71
72
# File 'app/models/cp_oraclecloud/java_component.rb', line 70

def instance_type
  "CpOraclecloud::JavaInstance"
end

#pretty_sizeObject



64
65
66
67
68
# File 'app/models/cp_oraclecloud/java_component.rb', line 64

def pretty_size
  if config && config.is_a?(Hash) && config.key?('shape')
    config['shape']
  end
end

#pretty_typeObject



60
61
62
# File 'app/models/cp_oraclecloud/java_component.rb', line 60

def pretty_type
  'Oracle Java Cloud Service'
end

#server_count_correctObject



38
39
40
# File 'app/models/cp_oraclecloud/java_component.rb', line 38

def server_count_correct
  if ![1,2,4,8].include?(num_nodes.to_i) then errors.add :num_nodes, "Invalid server count" end
end