cp_oraclecloud 0.1.9 → 0.1.10
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/README.md +118 -46
- data/app/controllers/cp_oraclecloud/compute_components_controller.rb +8 -8
- data/app/controllers/cp_oraclecloud/compute_instances_controller.rb +5 -5
- data/app/controllers/cp_oraclecloud/database_components_controller.rb +8 -8
- data/app/controllers/cp_oraclecloud/database_instances_controller.rb +11 -11
- data/app/controllers/cp_oraclecloud/java_components_controller.rb +8 -8
- data/app/controllers/cp_oraclecloud/java_instances_controller.rb +5 -5
- data/app/controllers/cp_oraclecloud/soa_components_controller.rb +8 -8
- data/app/controllers/cp_oraclecloud/soa_instances_controller.rb +5 -5
- data/app/controllers/cp_oraclecloud/ssh_keys_controller.rb +68 -68
- data/app/models/cp_oraclecloud/compute_component.rb +44 -44
- data/app/models/cp_oraclecloud/compute_instance.rb +55 -55
- data/app/models/cp_oraclecloud/database_component.rb +41 -41
- data/app/models/cp_oraclecloud/database_instance.rb +55 -55
- data/app/models/cp_oraclecloud/java_component.rb +78 -78
- data/app/models/cp_oraclecloud/java_instance.rb +55 -55
- data/app/models/cp_oraclecloud/soa_component.rb +58 -58
- data/app/models/cp_oraclecloud/soa_instance.rb +55 -55
- data/app/models/cp_oraclecloud/ssh_key.rb +61 -61
- data/app/policies/cp_oraclecloud/compute_component_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/compute_instance_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/database_component_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/database_instance_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/java_component_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/java_instance_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/soa_component_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/soa_instance_policy.rb +4 -4
- data/app/policies/cp_oraclecloud/ssh_key_policy.rb +25 -25
- data/app/views/cp_oraclecloud/compute_components/_fields.html.erb +4 -4
- data/app/views/cp_oraclecloud/compute_instances/_show.html.erb +8 -8
- data/app/views/cp_oraclecloud/database_components/_fields.html.erb +11 -11
- data/app/views/cp_oraclecloud/database_instances/_show.html.erb +112 -112
- data/app/views/cp_oraclecloud/java_components/_fields.html.erb +67 -67
- data/app/views/cp_oraclecloud/java_instances/_show.html.erb +36 -36
- data/app/views/cp_oraclecloud/soa_components/_fields.html.erb +36 -36
- data/app/views/cp_oraclecloud/soa_instances/_show.html.erb +8 -8
- data/app/views/cp_oraclecloud/ssh_keys/_form.html.erb +8 -8
- data/app/views/cp_oraclecloud/ssh_keys/edit.html.erb +3 -3
- data/app/views/cp_oraclecloud/ssh_keys/index.html.erb +33 -33
- data/app/views/cp_oraclecloud/ssh_keys/new.html.erb +3 -3
- data/app/views/products/_cp_oraclecloud_component_menu.html.erb +17 -17
- data/config/routes.rb +22 -22
- data/lib/cp_oraclecloud.rb +21 -23
- data/lib/cp_oraclecloud/compute_mixin.rb +7 -7
- data/lib/cp_oraclecloud/database_mixin.rb +26 -26
- data/lib/cp_oraclecloud/engine.rb +4 -0
- data/lib/cp_oraclecloud/java_mixin.rb +27 -27
- data/lib/cp_oraclecloud/soa_mixin.rb +13 -13
- data/lib/cp_oraclecloud/version.rb +3 -3
- metadata +15 -15
@@ -1,56 +1,56 @@
|
|
1
|
-
module CpOraclecloud
|
2
|
-
class JavaInstance < CloudInstance
|
3
|
-
include CpOraclecloud::JavaMixin
|
4
|
-
|
5
|
-
def provision
|
6
|
-
connection.instances.create(init_config)
|
7
|
-
end
|
8
|
-
|
9
|
-
def wait
|
10
|
-
fog.wait_for { ready? }
|
11
|
-
end
|
12
|
-
|
13
|
-
def provider
|
14
|
-
"OracleCloud"
|
15
|
-
end
|
16
|
-
|
17
|
-
def cloud_type
|
18
|
-
"Java"
|
19
|
-
end
|
20
|
-
|
21
|
-
def fog
|
22
|
-
@instance ||= connection.instances.get(name)
|
23
|
-
@instance
|
24
|
-
end
|
25
|
-
|
26
|
-
def attr_get(attribute)
|
27
|
-
begin
|
28
|
-
@instance ||= connection.instances.get(name)
|
29
|
-
@instance.attributes[attribute.to_sym]
|
30
|
-
rescue Fog::OracleCloud::Database::NotFound
|
31
|
-
"Error"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def month_cost
|
36
|
-
cost = calculate_monthly_cost(init_config)
|
37
|
-
cost
|
38
|
-
end
|
39
|
-
|
40
|
-
def calc_cost(start_date, end_date)
|
41
|
-
cost = 0
|
42
|
-
cost = (end_date - start_date) * (month_cost / 30)
|
43
|
-
cost
|
44
|
-
end
|
45
|
-
|
46
|
-
def connection
|
47
|
-
@connection ||= Fog::OracleCloud::Java.new(
|
48
|
-
:oracle_username => CpOraclecloud.username,
|
49
|
-
:oracle_password => CpOraclecloud.password,
|
50
|
-
:oracle_domain => CpOraclecloud.domain,
|
51
|
-
:oracle_region => CpOraclecloud.region
|
52
|
-
)
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
1
|
+
module CpOraclecloud
|
2
|
+
class JavaInstance < CloudInstance
|
3
|
+
include CpOraclecloud::JavaMixin
|
4
|
+
|
5
|
+
def provision
|
6
|
+
connection.instances.create(init_config)
|
7
|
+
end
|
8
|
+
|
9
|
+
def wait
|
10
|
+
fog.wait_for { ready? }
|
11
|
+
end
|
12
|
+
|
13
|
+
def provider
|
14
|
+
"OracleCloud"
|
15
|
+
end
|
16
|
+
|
17
|
+
def cloud_type
|
18
|
+
"Java"
|
19
|
+
end
|
20
|
+
|
21
|
+
def fog
|
22
|
+
@instance ||= connection.instances.get(name)
|
23
|
+
@instance
|
24
|
+
end
|
25
|
+
|
26
|
+
def attr_get(attribute)
|
27
|
+
begin
|
28
|
+
@instance ||= connection.instances.get(name)
|
29
|
+
@instance.attributes[attribute.to_sym]
|
30
|
+
rescue Fog::OracleCloud::Database::NotFound
|
31
|
+
"Error"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def month_cost
|
36
|
+
cost = calculate_monthly_cost(init_config)
|
37
|
+
cost
|
38
|
+
end
|
39
|
+
|
40
|
+
def calc_cost(start_date, end_date)
|
41
|
+
cost = 0
|
42
|
+
cost = (end_date - start_date) * (month_cost / 30)
|
43
|
+
cost
|
44
|
+
end
|
45
|
+
|
46
|
+
def connection
|
47
|
+
@connection ||= Fog::OracleCloud::Java.new(
|
48
|
+
:oracle_username => CpOraclecloud.username,
|
49
|
+
:oracle_password => CpOraclecloud.password,
|
50
|
+
:oracle_domain => CpOraclecloud.domain,
|
51
|
+
:oracle_region => CpOraclecloud.region
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
56
|
end
|
@@ -1,59 +1,59 @@
|
|
1
|
-
module CpOraclecloud
|
2
|
-
class SoaComponent < CloudComponent
|
3
|
-
include CpOraclecloud::SoaMixin
|
4
|
-
|
5
|
-
after_initialize :init
|
6
|
-
store :config, accessors: [:service_name, :cloud_storage_container, :cloud_storage_pwd, :cloud_storage_user, :description, :provision_otd, :subscription_type, :level, :topology, :admin_password, :admin_username, :dba_name, :dba_password, :db_service_name, :num_nodes, :shape, :ssh_key, :version], coder: JSON
|
7
|
-
|
8
|
-
enum shape: [:oc1m, :oc2m, :oc3m, :oc4m, :oc5m]
|
9
|
-
enum topology: [:soa, :osb, :soaosb, :b2b, :mft, :apim, :insight]
|
10
|
-
|
11
|
-
validates :service_name, :presence => true
|
12
|
-
validates :shape, :presence => true
|
13
|
-
validates :version, :presence => true
|
14
|
-
validates :ssh_key, :presence => true
|
15
|
-
validates :admin_password, :presence => true
|
16
|
-
validates :admin_username, :presence => true
|
17
|
-
validates :topology, :presence => true
|
18
|
-
|
19
|
-
validate :admin_password_complexity
|
20
|
-
validate :server_count_correct
|
21
|
-
|
22
|
-
def init
|
23
|
-
self.provision_otd ||= false
|
24
|
-
self.level ||= 'PAAS'
|
25
|
-
self.subscription_type ||= 'MONTHLY'
|
26
|
-
self.num_nodes ||= 1
|
27
|
-
end
|
28
|
-
|
29
|
-
def server_count_correct
|
30
|
-
if ![1,2,4].include?(num_nodes.to_i) then errors.add :num_nodes, "Invalid server count" end
|
31
|
-
end
|
32
|
-
|
33
|
-
def admin_password_complexity
|
34
|
-
if admin_password.size < 8 or admin_password.size > 30
|
35
|
-
errors.add :admin_password, "Must be at betweeen 8 and 30 characters long."
|
36
|
-
end
|
37
|
-
if !(admin_password[0] =~ /[[:alpha:]]/)
|
38
|
-
errors.add :admin_password, "First character must be a letter"
|
39
|
-
end
|
40
|
-
if (admin_password =~ /[a-z]/).blank? then errors.add :admin_password, 'Must contain a lower case letter' end
|
41
|
-
if (admin_password =~ /[A-Z]/).blank? then errors.add :admin_password, 'Must contain an upper case letter' end
|
42
|
-
if (admin_password =~ /[0-9]/).blank? then errors.add :admin_password, 'Must contain atleast one number' end
|
43
|
-
if (admin_password =~ /[-_#$]/).blank? then errors.add :admin_password, 'Must contain a special character (-, _, #, $)' end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
def pretty_type
|
48
|
-
'Oracle SOA Cloud Service'
|
49
|
-
end
|
50
|
-
|
51
|
-
def instance_name
|
52
|
-
"service_name"
|
53
|
-
end
|
54
|
-
|
55
|
-
def instance_type
|
56
|
-
"CpOraclecloud::SoaInstance"
|
57
|
-
end
|
58
|
-
end
|
1
|
+
module CpOraclecloud
|
2
|
+
class SoaComponent < CloudComponent
|
3
|
+
include CpOraclecloud::SoaMixin
|
4
|
+
|
5
|
+
after_initialize :init
|
6
|
+
store :config, accessors: [:service_name, :cloud_storage_container, :cloud_storage_pwd, :cloud_storage_user, :description, :provision_otd, :subscription_type, :level, :topology, :admin_password, :admin_username, :dba_name, :dba_password, :db_service_name, :num_nodes, :shape, :ssh_key, :version], coder: JSON
|
7
|
+
|
8
|
+
enum shape: [:oc1m, :oc2m, :oc3m, :oc4m, :oc5m]
|
9
|
+
enum topology: [:soa, :osb, :soaosb, :b2b, :mft, :apim, :insight]
|
10
|
+
|
11
|
+
validates :service_name, :presence => true
|
12
|
+
validates :shape, :presence => true
|
13
|
+
validates :version, :presence => true
|
14
|
+
validates :ssh_key, :presence => true
|
15
|
+
validates :admin_password, :presence => true
|
16
|
+
validates :admin_username, :presence => true
|
17
|
+
validates :topology, :presence => true
|
18
|
+
|
19
|
+
validate :admin_password_complexity
|
20
|
+
validate :server_count_correct
|
21
|
+
|
22
|
+
def init
|
23
|
+
self.provision_otd ||= false
|
24
|
+
self.level ||= 'PAAS'
|
25
|
+
self.subscription_type ||= 'MONTHLY'
|
26
|
+
self.num_nodes ||= 1
|
27
|
+
end
|
28
|
+
|
29
|
+
def server_count_correct
|
30
|
+
if ![1,2,4].include?(num_nodes.to_i) then errors.add :num_nodes, "Invalid server count" end
|
31
|
+
end
|
32
|
+
|
33
|
+
def admin_password_complexity
|
34
|
+
if admin_password.size < 8 or admin_password.size > 30
|
35
|
+
errors.add :admin_password, "Must be at betweeen 8 and 30 characters long."
|
36
|
+
end
|
37
|
+
if !(admin_password[0] =~ /[[:alpha:]]/)
|
38
|
+
errors.add :admin_password, "First character must be a letter"
|
39
|
+
end
|
40
|
+
if (admin_password =~ /[a-z]/).blank? then errors.add :admin_password, 'Must contain a lower case letter' end
|
41
|
+
if (admin_password =~ /[A-Z]/).blank? then errors.add :admin_password, 'Must contain an upper case letter' end
|
42
|
+
if (admin_password =~ /[0-9]/).blank? then errors.add :admin_password, 'Must contain atleast one number' end
|
43
|
+
if (admin_password =~ /[-_#$]/).blank? then errors.add :admin_password, 'Must contain a special character (-, _, #, $)' end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def pretty_type
|
48
|
+
'Oracle SOA Cloud Service'
|
49
|
+
end
|
50
|
+
|
51
|
+
def instance_name
|
52
|
+
"service_name"
|
53
|
+
end
|
54
|
+
|
55
|
+
def instance_type
|
56
|
+
"CpOraclecloud::SoaInstance"
|
57
|
+
end
|
58
|
+
end
|
59
59
|
end
|
@@ -1,56 +1,56 @@
|
|
1
|
-
module CpOraclecloud
|
2
|
-
class SoaInstance < CloudInstance
|
3
|
-
include CpOraclecloud::SoaMixin
|
4
|
-
|
5
|
-
def provision
|
6
|
-
connection.instances.create(init_config)
|
7
|
-
end
|
8
|
-
|
9
|
-
def wait
|
10
|
-
fog.wait_for { ready? }
|
11
|
-
end
|
12
|
-
|
13
|
-
def provider
|
14
|
-
"OracleCloud"
|
15
|
-
end
|
16
|
-
|
17
|
-
def cloud_type
|
18
|
-
"SOA"
|
19
|
-
end
|
20
|
-
|
21
|
-
def fog
|
22
|
-
@instance ||= connection.instances.get(name)
|
23
|
-
@instance
|
24
|
-
end
|
25
|
-
|
26
|
-
def attr_get(attribute)
|
27
|
-
begin
|
28
|
-
@instance ||= connection.instances.get(name)
|
29
|
-
@instance.attributes[attribute.to_sym]
|
30
|
-
rescue Fog::OracleCloud::Database::NotFound
|
31
|
-
"Error"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def month_cost
|
36
|
-
cost = calculate_monthly_cost(init_config)
|
37
|
-
cost
|
38
|
-
end
|
39
|
-
|
40
|
-
def calc_cost(start_date, end_date)
|
41
|
-
cost = 0
|
42
|
-
cost = (end_date - start_date) * (month_cost / 30)
|
43
|
-
cost
|
44
|
-
end
|
45
|
-
|
46
|
-
def connection
|
47
|
-
@connection ||= Fog::OracleCloud::SOA.new(
|
48
|
-
:oracle_username => CpOraclecloud.username,
|
49
|
-
:oracle_password => CpOraclecloud.password,
|
50
|
-
:oracle_domain => CpOraclecloud.domain,
|
51
|
-
:oracle_region => CpOraclecloud.region
|
52
|
-
)
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
1
|
+
module CpOraclecloud
|
2
|
+
class SoaInstance < CloudInstance
|
3
|
+
include CpOraclecloud::SoaMixin
|
4
|
+
|
5
|
+
def provision
|
6
|
+
connection.instances.create(init_config)
|
7
|
+
end
|
8
|
+
|
9
|
+
def wait
|
10
|
+
fog.wait_for { ready? }
|
11
|
+
end
|
12
|
+
|
13
|
+
def provider
|
14
|
+
"OracleCloud"
|
15
|
+
end
|
16
|
+
|
17
|
+
def cloud_type
|
18
|
+
"SOA"
|
19
|
+
end
|
20
|
+
|
21
|
+
def fog
|
22
|
+
@instance ||= connection.instances.get(name)
|
23
|
+
@instance
|
24
|
+
end
|
25
|
+
|
26
|
+
def attr_get(attribute)
|
27
|
+
begin
|
28
|
+
@instance ||= connection.instances.get(name)
|
29
|
+
@instance.attributes[attribute.to_sym]
|
30
|
+
rescue Fog::OracleCloud::Database::NotFound
|
31
|
+
"Error"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def month_cost
|
36
|
+
cost = calculate_monthly_cost(init_config)
|
37
|
+
cost
|
38
|
+
end
|
39
|
+
|
40
|
+
def calc_cost(start_date, end_date)
|
41
|
+
cost = 0
|
42
|
+
cost = (end_date - start_date) * (month_cost / 30)
|
43
|
+
cost
|
44
|
+
end
|
45
|
+
|
46
|
+
def connection
|
47
|
+
@connection ||= Fog::OracleCloud::SOA.new(
|
48
|
+
:oracle_username => CpOraclecloud.username,
|
49
|
+
:oracle_password => CpOraclecloud.password,
|
50
|
+
:oracle_domain => CpOraclecloud.domain,
|
51
|
+
:oracle_region => CpOraclecloud.region
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
56
|
end
|
@@ -1,62 +1,62 @@
|
|
1
|
-
module CpOraclecloud
|
2
|
-
class SshKey
|
3
|
-
include ActiveModel::Validations
|
4
|
-
include ActiveModel::Conversion
|
5
|
-
extend ActiveModel::Naming
|
6
|
-
|
7
|
-
attr_accessor :uri, :enabled, :key, :name
|
8
|
-
|
9
|
-
validates :enabled, inclusion: [true, false]
|
10
|
-
validates :key, :presence => true
|
11
|
-
validates :name, :presence => true
|
12
|
-
|
13
|
-
|
14
|
-
def initialize(attributes = {})
|
15
|
-
attributes.each do |name, value|
|
16
|
-
send("#{name}=", value)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_model
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
def persisted?
|
25
|
-
false
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.all
|
29
|
-
connection.ssh_keys
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.find_by_id(id)
|
33
|
-
connection.ssh_keys.get(id)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.create(params)
|
37
|
-
connection.ssh_keys.create(:name => params[:name],
|
38
|
-
:enabled => params[:enabled],
|
39
|
-
:key => params[:key])
|
40
|
-
end
|
41
|
-
|
42
|
-
def save
|
43
|
-
self.connection.ssh_keys.create(:name => name,
|
44
|
-
:enabled => enabled,
|
45
|
-
:key => key)
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.delete(id)
|
49
|
-
connection.ssh_keys.get(id).destroy
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.connection
|
53
|
-
@connection ||= Fog::Compute.new(
|
54
|
-
:provider => 'OracleCloud',
|
55
|
-
:oracle_username => CpOraclecloud.username,
|
56
|
-
:oracle_password => CpOraclecloud.password,
|
57
|
-
:oracle_domain => CpOraclecloud.domain,
|
58
|
-
:oracle_compute_api => CpOraclecloud.compute_api
|
59
|
-
)
|
60
|
-
end
|
61
|
-
end
|
1
|
+
module CpOraclecloud
|
2
|
+
class SshKey
|
3
|
+
include ActiveModel::Validations
|
4
|
+
include ActiveModel::Conversion
|
5
|
+
extend ActiveModel::Naming
|
6
|
+
|
7
|
+
attr_accessor :uri, :enabled, :key, :name
|
8
|
+
|
9
|
+
validates :enabled, inclusion: [true, false]
|
10
|
+
validates :key, :presence => true
|
11
|
+
validates :name, :presence => true
|
12
|
+
|
13
|
+
|
14
|
+
def initialize(attributes = {})
|
15
|
+
attributes.each do |name, value|
|
16
|
+
send("#{name}=", value)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_model
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def persisted?
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.all
|
29
|
+
connection.ssh_keys
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.find_by_id(id)
|
33
|
+
connection.ssh_keys.get(id)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.create(params)
|
37
|
+
connection.ssh_keys.create(:name => params[:name],
|
38
|
+
:enabled => params[:enabled],
|
39
|
+
:key => params[:key])
|
40
|
+
end
|
41
|
+
|
42
|
+
def save
|
43
|
+
self.connection.ssh_keys.create(:name => name,
|
44
|
+
:enabled => enabled,
|
45
|
+
:key => key)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.delete(id)
|
49
|
+
connection.ssh_keys.get(id).destroy
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.connection
|
53
|
+
@connection ||= Fog::Compute.new(
|
54
|
+
:provider => 'OracleCloud',
|
55
|
+
:oracle_username => CpOraclecloud.username,
|
56
|
+
:oracle_password => CpOraclecloud.password,
|
57
|
+
:oracle_domain => CpOraclecloud.domain,
|
58
|
+
:oracle_compute_api => CpOraclecloud.compute_api
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
62
|
end
|