cp_oraclecloud 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/cp_oraclecloud/java_components_controller.rb +9 -0
- data/app/models/cp_oraclecloud/database_instance.rb +4 -0
- data/app/models/cp_oraclecloud/java_component.rb +91 -0
- data/app/models/cp_oraclecloud/java_instance.rb +54 -0
- data/app/views/cp_oraclecloud/java_components/_fields.html.erb +68 -0
- data/config/routes.rb +4 -0
- data/lib/cp_oraclecloud/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a839cf27bf08b34c85237dd832567b51f4b24971
|
4
|
+
data.tar.gz: 7246253711b7a7e5ab12b5243c33a26e621bc224
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 201e38663ac20bc1e4a92169b0d82c1bbf3e24ffae0fb5d1c1ecc1bd130125ba144ee4ce07581bb8761e20f045e086563b0f4a506023e773a1d366d2f657b082
|
7
|
+
data.tar.gz: 933a1ae6ef61e064cb7ad96e469a51c8c05e29f18a6e7fa81859c8175869722f42e6da9a3289c8568ef60d73caf1fa1051c70b7616c1c83b26c859c5d3e92d9d
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module CpOraclecloud
|
2
|
+
class JavaComponentsController < CloudComponentsController
|
3
|
+
|
4
|
+
private
|
5
|
+
def component_params
|
6
|
+
params.require(:cp_oraclecloud_java_component).permit(:service_name, :cloud_storage_container, :cloud_storage_pwd, :cloud_storage_user, :cloud_storage_if_missing, :description, :enable_admin_console, :provision_otd, :sample_app_deployment_requested, :subscription_type, :level, :admin_password, :admin_port, :admin_username, :backup_volume_size, :cluster_name, :content_port, :dba_name, :dba_password, :db_service_name, :wls_deployment_channel_port, :domain_mode, :domain_name, :domain_partition_count, :domain_volume_size, :edition, :num_nodes, :ms_initial_heap_mb, :ms_jvm_args, :ms_max_heap_mb, :ms_max_perm_mb, :node_manager_password, :node_manager_port, :node_manager_username, :overwrite_ms_jvm_args, :pdb_name, :secured_admin_port, :secured_content_port, :shape, :ssh_key, :version)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module CpOraclecloud
|
2
|
+
class JavaComponent < CloudComponent
|
3
|
+
after_initialize :init
|
4
|
+
store :config, accessors: [:service_name, :cloud_storage_container, :cloud_storage_pwd, :cloud_storage_user, :cloud_storage_if_missing, :description, :enable_admin_console, :provision_otd, :sample_app_deployment_requested, :subscription_type, :level, :admin_password, :admin_port, :admin_username, :backup_volume_size, :cluster_name, :content_port, :dba_name, :dba_password, :db_service_name, :wls_deployment_channel_port, :domain_mode, :domain_name, :domain_partition_count, :domain_volume_size, :edition, :num_nodes, :ms_initial_heap_mb, :ms_jvm_args, :ms_max_heap_mb, :ms_max_perm_mb, :node_manager_password, :node_manager_port, :node_manager_username, :overwrite_ms_jvm_args, :pdb_name, :secured_admin_port, :secured_content_port, :shape, :ssh_key, :version], coder: JSON
|
5
|
+
|
6
|
+
enum edition: [:SE, :EE, :SUITE]
|
7
|
+
enum shape: [:oc3, :oc4, :oc5, :oc6, :oc1m, :oc2m, :oc3m, :oc4m]
|
8
|
+
enum level: [:PAAS, :BASIC]
|
9
|
+
enum subscription_type: [:HOURLY, :MONTHLY]
|
10
|
+
enum domain_mode: [:DEVELOPMENT, :PRODUCTION]
|
11
|
+
|
12
|
+
validates :service_name, :presence => true
|
13
|
+
validates :dba_name, :presence => true
|
14
|
+
validates :dba_password, :presence => true
|
15
|
+
validates :db_service_name, :presence => true
|
16
|
+
validates :shape, :presence => true
|
17
|
+
validates :version, :presence => true
|
18
|
+
validates :ssh_key, :presence => true
|
19
|
+
validates :admin_password, :presence => true
|
20
|
+
#validates_inclusion_of :num_nodes, :in => [1,2,4,8]
|
21
|
+
#validates :domain_partition_count, :inclusion => {:in => [0,1,2,4]}
|
22
|
+
|
23
|
+
validate :admin_password_complexity
|
24
|
+
validate :server_count_correct
|
25
|
+
validate :domain_partition_correct
|
26
|
+
|
27
|
+
def init
|
28
|
+
self.enable_admin_console ||= true
|
29
|
+
self.provision_otd ||= true
|
30
|
+
self.level ||= 'PAAS'
|
31
|
+
self.subscription_type ||= 'HOURLY'
|
32
|
+
self.edition ||= 'EE'
|
33
|
+
self.num_nodes ||= 1
|
34
|
+
end
|
35
|
+
|
36
|
+
def server_count_correct
|
37
|
+
if ![1,2,4,8].include?(num_nodes.to_i) then errors.add :num_nodes, "Invalid server count" end
|
38
|
+
end
|
39
|
+
|
40
|
+
def domain_partition_correct
|
41
|
+
if ![0,1,2,4].include?(domain_partition_count.to_i) then errors.add :domain_partition_count, "Invalid Domain Partition Count" end
|
42
|
+
end
|
43
|
+
|
44
|
+
def admin_password_complexity
|
45
|
+
if admin_password.size < 8 or admin_password.size > 30
|
46
|
+
errors.add :admin_password, "Must be at betweeen 8 and 30 characters long."
|
47
|
+
end
|
48
|
+
if !(admin_password[0] =~ /[[:alpha:]]/)
|
49
|
+
errors.add :admin_password, "First character must be a letter"
|
50
|
+
end
|
51
|
+
if (admin_password =~ /[a-z]/).blank? then errors.add :admin_password, 'Must contain a lower case letter' end
|
52
|
+
if (admin_password =~ /[A-Z]/).blank? then errors.add :admin_password, 'Must contain an upper case letter' end
|
53
|
+
if (admin_password =~ /[0-9]/).blank? then errors.add :admin_password, 'Must contain atleast one number' end
|
54
|
+
if (admin_password =~ /[-_#$]/).blank? then errors.add :admin_password, 'Must contain a special character (-, _, #, $)' end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
def pretty_type
|
59
|
+
'Oracle Java Cloud Service'
|
60
|
+
end
|
61
|
+
|
62
|
+
def pretty_size
|
63
|
+
if config && config.is_a?(Hash) && config.key?('shape')
|
64
|
+
config['shape']
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# These should be constants, can't work out
|
69
|
+
# how to access them that way though
|
70
|
+
def self.provider
|
71
|
+
"OracleCloud"
|
72
|
+
end
|
73
|
+
|
74
|
+
def provider
|
75
|
+
"OracleCloud"
|
76
|
+
end
|
77
|
+
|
78
|
+
def fog_type
|
79
|
+
"Java"
|
80
|
+
end
|
81
|
+
|
82
|
+
def instance_type
|
83
|
+
"CpOraclecloud::JavaInstance"
|
84
|
+
end
|
85
|
+
|
86
|
+
def instance_name
|
87
|
+
"service_name"
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module CpOraclecloud
|
2
|
+
class JavaInstance < CloudInstance
|
3
|
+
|
4
|
+
def provision
|
5
|
+
connection.instances.create(init_config)
|
6
|
+
end
|
7
|
+
|
8
|
+
def wait
|
9
|
+
fog.wait_for { ready? }
|
10
|
+
end
|
11
|
+
|
12
|
+
def provider
|
13
|
+
"OracleCloud"
|
14
|
+
end
|
15
|
+
|
16
|
+
def cloud_type
|
17
|
+
"Java"
|
18
|
+
end
|
19
|
+
|
20
|
+
def fog
|
21
|
+
@instance ||= connection.instances.get(name)
|
22
|
+
@instance
|
23
|
+
end
|
24
|
+
|
25
|
+
def attr_get(attribute)
|
26
|
+
begin
|
27
|
+
@instance ||= connection.instances.get(name)
|
28
|
+
@instance.attributes[attribute.to_sym]
|
29
|
+
rescue Fog::OracleCloud::Database::NotFound
|
30
|
+
"Error"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def month_cost
|
35
|
+
cost = 0
|
36
|
+
cost
|
37
|
+
end
|
38
|
+
|
39
|
+
def calc_cost(start_date, end_date)
|
40
|
+
cost = 0
|
41
|
+
cost = (end_date - start_date) * (month_cost / 30)
|
42
|
+
cost
|
43
|
+
end
|
44
|
+
|
45
|
+
def connection
|
46
|
+
@connection ||= Fog::OracleCloud::Java.new(
|
47
|
+
:oracle_username => APP_CONFIG[:oracle_username],
|
48
|
+
:oracle_password => APP_CONFIG[:oracle_password],
|
49
|
+
:oracle_domain => APP_CONFIG[:oracle_domain],
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<em>Required fields are on the General and Database tabs. You can ignore the rest if needed</em>
|
2
|
+
<ul class="nav nav-tabs">
|
3
|
+
<li role="presentation" class="active"><a href="#general" data-toggle="tab">* General</a></li>
|
4
|
+
<li role="presentation"><a href="#database" data-toggle="tab"> * Database</a></li>
|
5
|
+
<li role="presentation"><a href="#storage" data-toggle="tab"> Storage</a></li>
|
6
|
+
<li role="presentation"><a href="#networking" data-toggle="tab"> Networking</a></li>
|
7
|
+
<li role="presentation"><a href="#config" data-toggle="tab">Server Config</a></li>
|
8
|
+
</ul>
|
9
|
+
|
10
|
+
|
11
|
+
<div class="tab-content ">
|
12
|
+
<div class="tab-pane active" id="general">
|
13
|
+
<%= f.input :service_name %>
|
14
|
+
<%= f.input :description %>
|
15
|
+
<%= f.input :edition, :label_method=> lambda { |item| "#{item.first.upcase}" } %>
|
16
|
+
<%= f.input :shape %>
|
17
|
+
<%= f.input :num_nodes, label: 'Managed Server Count', as: :integer, hint: 'Valid values: 1, 2, 4, 8' %>
|
18
|
+
<%= f.input :version %>
|
19
|
+
<%= f.input :level, :label_method=> lambda { |item| "#{item.first.upcase}" } %>
|
20
|
+
<%= f.input :subscription_type, :label_method=> lambda { |item| "#{item.first.upcase}" } %>
|
21
|
+
<%= f.input :ssh_key %>
|
22
|
+
<%= f.input :admin_username %>
|
23
|
+
<%= f.input :admin_password, input_html: { value: @component.admin_password } %>
|
24
|
+
</div>
|
25
|
+
<div class="tab-pane" id="storage">
|
26
|
+
<em>If you leave these blank, the system will create a storage container with the name '%service_name%_backup'</em>
|
27
|
+
<%= f.input :cloud_storage_container %>
|
28
|
+
<%= f.input :cloud_storage_user %>
|
29
|
+
<%= f.input :cloud_storage_pwd, input_html: { value: @component.cloud_storage_pwd }%>
|
30
|
+
<%= f.input :cloud_storage_if_missing, as: :boolean, label: 'Create storage container if missing?' %>
|
31
|
+
<%= f.input :backup_volume_size, hint: 'In bytes or GBs (with a G). Ie: 100000000000 or 10G' %>
|
32
|
+
<%= f.input :domain_volume_size, hint: 'In bytes or GBs (with a G). Ie: 100000000000 or 10G' %>
|
33
|
+
|
34
|
+
</div>
|
35
|
+
<div class="tab-pane" id="database">
|
36
|
+
<%= f.input :db_service_name %>
|
37
|
+
<%= f.input :dba_name %>
|
38
|
+
<%= f.input :dba_password, input_html: { value: @component.dba_password }%>
|
39
|
+
<%= f.input :pdb_name, hint: 'Will use default PDB is not provided. Only valid for 12c databases' %>
|
40
|
+
|
41
|
+
</div>
|
42
|
+
<div class="tab-pane" id="networking">
|
43
|
+
<%= f.input :enable_admin_console, as: :boolean, hint: 'Configures networking to the admin console' %>
|
44
|
+
<%= f.input :provision_otd, as: :boolean %>
|
45
|
+
<%= f.input :admin_port, input_html: { placeholder: 7001 } %>
|
46
|
+
<%= f.input :content_port, input_html: { placeholder: 8001 } %>
|
47
|
+
<%= f.input :wls_deployment_channel_port, input_html: { placeholder: 9001 }, label: 'Deployment Channel Port', hint: 'Port used for accessing admin server using WLST' %>
|
48
|
+
<%= f.input :node_manager_port, input_html: { placeholder: 5556 } %>
|
49
|
+
<%= f.input :secured_admin_port, input_html: { placeholder: 7002 } %>
|
50
|
+
<%= f.input :secured_content_port, input_html: { placeholder: 8002 } %>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
<div class="tab-pane" id="config">
|
54
|
+
<%= f.input :cluster_name, hint: 'Leave blank to have %service_name%_cluster' %>
|
55
|
+
<%= f.input :domain_name, hint: 'Leave blank to have %service_name%_domain' %>
|
56
|
+
<%= f.input :domain_mode %>
|
57
|
+
<%= f.input :domain_partition_count, as: :integer, hint: 'Valid values: 0, 1, 2, 4' %>
|
58
|
+
<%= f.input :node_manager_username %>
|
59
|
+
<%= f.input :node_manager_password, input_html: { value: @component.node_manager_password } %>
|
60
|
+
|
61
|
+
<%= f.input :ms_initial_heap_mb %>
|
62
|
+
<%= f.input :ms_jvm_args %>
|
63
|
+
<%= f.input :ms_max_heap_mb %>
|
64
|
+
<%= f.input :ms_max_perm_mb %>
|
65
|
+
<%= f.input :overwrite_ms_jvm_args %>
|
66
|
+
<%= f.input :sample_app_deployment_requested, as: :boolean %>
|
67
|
+
</div>
|
68
|
+
</div>
|
data/config/routes.rb
CHANGED
@@ -2,6 +2,7 @@ Rails.application.routes.draw do
|
|
2
2
|
resources :products do
|
3
3
|
namespace :cp_oraclecloud do
|
4
4
|
resources :database_components, type: 'CpOraclecloud::DatabaseComponent'
|
5
|
+
resources :java_components, type: 'CpOraclecloud::JavaComponent'
|
5
6
|
end
|
6
7
|
end
|
7
8
|
|
@@ -9,5 +10,8 @@ Rails.application.routes.draw do
|
|
9
10
|
resources :database_instances, type: 'CpOraclecloud::DatabaseInstance' do
|
10
11
|
put :backup
|
11
12
|
end
|
13
|
+
resources :java_instances, type: 'CpOraclecloud::JavaInstance' do
|
14
|
+
put :backup
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cp_oraclecloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Nation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -57,10 +57,14 @@ files:
|
|
57
57
|
- app/assets/config/cp_oraclecloud_manifest.js
|
58
58
|
- app/controllers/cp_oraclecloud/database_components_controller.rb
|
59
59
|
- app/controllers/cp_oraclecloud/database_instances_controller.rb
|
60
|
+
- app/controllers/cp_oraclecloud/java_components_controller.rb
|
60
61
|
- app/models/cp_oraclecloud/database_component.rb
|
61
62
|
- app/models/cp_oraclecloud/database_instance.rb
|
63
|
+
- app/models/cp_oraclecloud/java_component.rb
|
64
|
+
- app/models/cp_oraclecloud/java_instance.rb
|
62
65
|
- app/views/cp_oraclecloud/database_components/_fields.html.erb
|
63
66
|
- app/views/cp_oraclecloud/database_instances/_show.html.erb
|
67
|
+
- app/views/cp_oraclecloud/java_components/_fields.html.erb
|
64
68
|
- config/routes.rb
|
65
69
|
- lib/cp_oraclecloud.rb
|
66
70
|
- lib/cp_oraclecloud/engine.rb
|