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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +118 -46
  3. data/app/controllers/cp_oraclecloud/compute_components_controller.rb +8 -8
  4. data/app/controllers/cp_oraclecloud/compute_instances_controller.rb +5 -5
  5. data/app/controllers/cp_oraclecloud/database_components_controller.rb +8 -8
  6. data/app/controllers/cp_oraclecloud/database_instances_controller.rb +11 -11
  7. data/app/controllers/cp_oraclecloud/java_components_controller.rb +8 -8
  8. data/app/controllers/cp_oraclecloud/java_instances_controller.rb +5 -5
  9. data/app/controllers/cp_oraclecloud/soa_components_controller.rb +8 -8
  10. data/app/controllers/cp_oraclecloud/soa_instances_controller.rb +5 -5
  11. data/app/controllers/cp_oraclecloud/ssh_keys_controller.rb +68 -68
  12. data/app/models/cp_oraclecloud/compute_component.rb +44 -44
  13. data/app/models/cp_oraclecloud/compute_instance.rb +55 -55
  14. data/app/models/cp_oraclecloud/database_component.rb +41 -41
  15. data/app/models/cp_oraclecloud/database_instance.rb +55 -55
  16. data/app/models/cp_oraclecloud/java_component.rb +78 -78
  17. data/app/models/cp_oraclecloud/java_instance.rb +55 -55
  18. data/app/models/cp_oraclecloud/soa_component.rb +58 -58
  19. data/app/models/cp_oraclecloud/soa_instance.rb +55 -55
  20. data/app/models/cp_oraclecloud/ssh_key.rb +61 -61
  21. data/app/policies/cp_oraclecloud/compute_component_policy.rb +4 -4
  22. data/app/policies/cp_oraclecloud/compute_instance_policy.rb +4 -4
  23. data/app/policies/cp_oraclecloud/database_component_policy.rb +4 -4
  24. data/app/policies/cp_oraclecloud/database_instance_policy.rb +4 -4
  25. data/app/policies/cp_oraclecloud/java_component_policy.rb +4 -4
  26. data/app/policies/cp_oraclecloud/java_instance_policy.rb +4 -4
  27. data/app/policies/cp_oraclecloud/soa_component_policy.rb +4 -4
  28. data/app/policies/cp_oraclecloud/soa_instance_policy.rb +4 -4
  29. data/app/policies/cp_oraclecloud/ssh_key_policy.rb +25 -25
  30. data/app/views/cp_oraclecloud/compute_components/_fields.html.erb +4 -4
  31. data/app/views/cp_oraclecloud/compute_instances/_show.html.erb +8 -8
  32. data/app/views/cp_oraclecloud/database_components/_fields.html.erb +11 -11
  33. data/app/views/cp_oraclecloud/database_instances/_show.html.erb +112 -112
  34. data/app/views/cp_oraclecloud/java_components/_fields.html.erb +67 -67
  35. data/app/views/cp_oraclecloud/java_instances/_show.html.erb +36 -36
  36. data/app/views/cp_oraclecloud/soa_components/_fields.html.erb +36 -36
  37. data/app/views/cp_oraclecloud/soa_instances/_show.html.erb +8 -8
  38. data/app/views/cp_oraclecloud/ssh_keys/_form.html.erb +8 -8
  39. data/app/views/cp_oraclecloud/ssh_keys/edit.html.erb +3 -3
  40. data/app/views/cp_oraclecloud/ssh_keys/index.html.erb +33 -33
  41. data/app/views/cp_oraclecloud/ssh_keys/new.html.erb +3 -3
  42. data/app/views/products/_cp_oraclecloud_component_menu.html.erb +17 -17
  43. data/config/routes.rb +22 -22
  44. data/lib/cp_oraclecloud.rb +21 -23
  45. data/lib/cp_oraclecloud/compute_mixin.rb +7 -7
  46. data/lib/cp_oraclecloud/database_mixin.rb +26 -26
  47. data/lib/cp_oraclecloud/engine.rb +4 -0
  48. data/lib/cp_oraclecloud/java_mixin.rb +27 -27
  49. data/lib/cp_oraclecloud/soa_mixin.rb +13 -13
  50. data/lib/cp_oraclecloud/version.rb +3 -3
  51. metadata +15 -15
@@ -1,45 +1,45 @@
1
- module CpOraclecloud
2
- class ComputeComponent < CloudComponent
3
- include CpOraclecloud::ComputeMixin
4
-
5
- store :config, accessors: [:name, :shape, :imagelist, :label, :sshkeys], coder: JSON
6
-
7
- enum shape: [:oc3, :oc4, :oc5, :oc6, :oc1m, :oc2m, :oc3m, :oc4m]
8
-
9
- validates :name, :presence => true
10
- validates :imagelist, :presence => true
11
- validates :shape, :presence => true
12
- validates :sshkeys, :presence => true
13
-
14
- def all_image_lists
15
- connection.image_lists.all
16
- end
17
-
18
- def all_ssh_keys
19
- connection.ssh_keys.all
20
- end
21
-
22
- def pretty_type
23
- 'Oracle Compute Instance'
24
- end
25
-
26
- def instance_type
27
- "CpOraclecloud::ComputeInstance"
28
- end
29
-
30
- def instance_name
31
- "name"
32
- end
33
-
34
- def connection
35
- @connection ||= Fog::Compute.new(
36
- :provider => 'OracleCloud',
37
- :oracle_username => CpOraclecloud.username,
38
- :oracle_password => CpOraclecloud.password,
39
- :oracle_domain => CpOraclecloud.domain,
40
- :oracle_compute_api => CpOraclecloud.compute_api
41
- )
42
- end
43
-
44
- end
1
+ module CpOraclecloud
2
+ class ComputeComponent < CloudComponent
3
+ include CpOraclecloud::ComputeMixin
4
+
5
+ store :config, accessors: [:name, :shape, :imagelist, :label, :sshkeys], coder: JSON
6
+
7
+ enum shape: [:oc3, :oc4, :oc5, :oc6, :oc1m, :oc2m, :oc3m, :oc4m]
8
+
9
+ validates :name, :presence => true
10
+ validates :imagelist, :presence => true
11
+ validates :shape, :presence => true
12
+ validates :sshkeys, :presence => true
13
+
14
+ def all_image_lists
15
+ connection.image_lists.all
16
+ end
17
+
18
+ def all_ssh_keys
19
+ connection.ssh_keys.all
20
+ end
21
+
22
+ def pretty_type
23
+ 'Oracle Compute Instance'
24
+ end
25
+
26
+ def instance_type
27
+ "CpOraclecloud::ComputeInstance"
28
+ end
29
+
30
+ def instance_name
31
+ "name"
32
+ end
33
+
34
+ def connection
35
+ @connection ||= Fog::Compute.new(
36
+ :provider => 'OracleCloud',
37
+ :oracle_username => CpOraclecloud.username,
38
+ :oracle_password => CpOraclecloud.password,
39
+ :oracle_domain => CpOraclecloud.domain,
40
+ :oracle_compute_api => CpOraclecloud.compute_api
41
+ )
42
+ end
43
+
44
+ end
45
45
  end
@@ -1,56 +1,56 @@
1
- module CpOraclecloud
2
- class ComputeInstance < CloudInstance
3
- include CpOraclecloud::ComputeMixin
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
- "Compute"
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::Compute::OracleCloud::NotFound
31
- "Error"
32
- end
33
- end
34
-
35
- def month_cost
36
- calculate_monthly_cost(init_config)
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::Compute.new(
47
- :provider => 'OracleCloud',
48
- :oracle_username => CpOraclecloud.username,
49
- :oracle_password => CpOraclecloud.password,
50
- :oracle_domain => CpOraclecloud.domain,
51
- :oracle_compute_api => CpOraclecloud.compute_api
52
- )
53
- end
54
-
55
- end
1
+ module CpOraclecloud
2
+ class ComputeInstance < CloudInstance
3
+ include CpOraclecloud::ComputeMixin
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
+ "Compute"
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::Compute::OracleCloud::NotFound
31
+ "Error"
32
+ end
33
+ end
34
+
35
+ def month_cost
36
+ calculate_monthly_cost(init_config)
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::Compute.new(
47
+ :provider => 'OracleCloud',
48
+ :oracle_username => CpOraclecloud.username,
49
+ :oracle_password => CpOraclecloud.password,
50
+ :oracle_domain => CpOraclecloud.domain,
51
+ :oracle_compute_api => CpOraclecloud.compute_api
52
+ )
53
+ end
54
+
55
+ end
56
56
  end
@@ -1,42 +1,42 @@
1
- module CpOraclecloud
2
- class DatabaseComponent < CloudComponent
3
- include CpOraclecloud::DatabaseMixin
4
-
5
- store :config, accessors: [:service_name, :version, :description, :ssh_key, :shape, :level, :subscription_type, :edition, :backup_destination, :admin_password], coder: JSON
6
-
7
- enum edition: [:SE, :EE, :EE_HP, :EE_EP]
8
- enum shape: [:oc3, :oc4, :oc5, :oc6, :oc1m, :oc2m, :oc3m, :oc4m]
9
- enum level: [:PAAS, :BASIC]
10
- enum subscription_type: [:HOURLY, :MONTHLY]
11
- enum backup_destination: [:NONE, :OSS, :BOTH]
12
-
13
- validates :service_name, :presence => true
14
- validates :edition, :presence => true
15
- validates :ssh_key, :presence => true
16
- validates :shape, :presence => true
17
- validates :version, :presence => true
18
- validates :level, :presence => true
19
- validates :subscription_type, :presence => true
20
- validates :admin_password, :presence => true
21
- validates :backup_destination, :presence => true
22
-
23
- def pretty_type
24
- 'Oracle Database CS'
25
- end
26
-
27
- def pretty_size
28
- if config && config.is_a?(Hash) && config.key?('shape')
29
- config['shape']
30
- end
31
- end
32
-
33
- def instance_type
34
- "CpOraclecloud::DatabaseInstance"
35
- end
36
-
37
- def instance_name
38
- "service_name"
39
- end
40
-
41
- end
1
+ module CpOraclecloud
2
+ class DatabaseComponent < CloudComponent
3
+ include CpOraclecloud::DatabaseMixin
4
+
5
+ store :config, accessors: [:service_name, :version, :description, :ssh_key, :shape, :level, :subscription_type, :edition, :backup_destination, :admin_password], coder: JSON
6
+
7
+ enum edition: [:SE, :EE, :EE_HP, :EE_EP]
8
+ enum shape: [:oc3, :oc4, :oc5, :oc6, :oc1m, :oc2m, :oc3m, :oc4m]
9
+ enum level: [:PAAS, :BASIC]
10
+ enum subscription_type: [:HOURLY, :MONTHLY]
11
+ enum backup_destination: [:NONE, :OSS, :BOTH]
12
+
13
+ validates :service_name, :presence => true
14
+ validates :edition, :presence => true
15
+ validates :ssh_key, :presence => true
16
+ validates :shape, :presence => true
17
+ validates :version, :presence => true
18
+ validates :level, :presence => true
19
+ validates :subscription_type, :presence => true
20
+ validates :admin_password, :presence => true
21
+ validates :backup_destination, :presence => true
22
+
23
+ def pretty_type
24
+ 'Oracle Database CS'
25
+ end
26
+
27
+ def pretty_size
28
+ if config && config.is_a?(Hash) && config.key?('shape')
29
+ config['shape']
30
+ end
31
+ end
32
+
33
+ def instance_type
34
+ "CpOraclecloud::DatabaseInstance"
35
+ end
36
+
37
+ def instance_name
38
+ "service_name"
39
+ end
40
+
41
+ end
42
42
  end
@@ -1,56 +1,56 @@
1
- module CpOraclecloud
2
- class DatabaseInstance < CloudInstance
3
- include CpOraclecloud::DatabaseMixin
4
-
5
- def provision
6
- @instance = 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
- "Database"
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::Database.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 DatabaseInstance < CloudInstance
3
+ include CpOraclecloud::DatabaseMixin
4
+
5
+ def provision
6
+ @instance = 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
+ "Database"
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::Database.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,79 +1,79 @@
1
- module CpOraclecloud
2
- class JavaComponent < CloudComponent
3
- include CpOraclecloud::JavaMixin
4
-
5
- after_initialize :init
6
- 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
7
-
8
- enum edition: [:SE, :EE, :SUITE]
9
- enum shape: [:oc3, :oc4, :oc5, :oc6, :oc1m, :oc2m, :oc3m, :oc4m]
10
- enum level: [:PAAS, :BASIC]
11
- enum subscription_type: [:HOURLY, :MONTHLY]
12
- enum domain_mode: [:DEVELOPMENT, :PRODUCTION]
13
-
14
- validates :service_name, :presence => true
15
- validates :dba_name, :presence => true
16
- validates :dba_password, :presence => true
17
- validates :db_service_name, :presence => true
18
- validates :shape, :presence => true
19
- validates :version, :presence => true
20
- validates :ssh_key, :presence => true
21
- validates :admin_password, :presence => true
22
- #validates_inclusion_of :num_nodes, :in => [1,2,4,8]
23
- #validates :domain_partition_count, :inclusion => {:in => [0,1,2,4]}
24
-
25
- validate :admin_password_complexity
26
- validate :server_count_correct
27
- validate :domain_partition_correct
28
-
29
- def init
30
- self.enable_admin_console ||= true
31
- self.provision_otd ||= true
32
- self.level ||= 'PAAS'
33
- self.subscription_type ||= 'HOURLY'
34
- self.edition ||= 'EE'
35
- self.num_nodes ||= 1
36
- end
37
-
38
- def server_count_correct
39
- if ![1,2,4,8].include?(num_nodes.to_i) then errors.add :num_nodes, "Invalid server count" end
40
- end
41
-
42
- def domain_partition_correct
43
- if ![0,1,2,4].include?(domain_partition_count.to_i) then errors.add :domain_partition_count, "Invalid Domain Partition Count" end
44
- end
45
-
46
- def admin_password_complexity
47
- if admin_password.size < 8 or admin_password.size > 30
48
- errors.add :admin_password, "Must be at betweeen 8 and 30 characters long."
49
- end
50
- if !(admin_password[0] =~ /[[:alpha:]]/)
51
- errors.add :admin_password, "First character must be a letter"
52
- end
53
- if (admin_password =~ /[a-z]/).blank? then errors.add :admin_password, 'Must contain a lower case letter' end
54
- if (admin_password =~ /[A-Z]/).blank? then errors.add :admin_password, 'Must contain an upper case letter' end
55
- if (admin_password =~ /[0-9]/).blank? then errors.add :admin_password, 'Must contain atleast one number' end
56
- if (admin_password =~ /[-_#$]/).blank? then errors.add :admin_password, 'Must contain a special character (-, _, #, $)' end
57
-
58
- end
59
-
60
- def pretty_type
61
- 'Oracle Java Cloud Service'
62
- end
63
-
64
- def pretty_size
65
- if config && config.is_a?(Hash) && config.key?('shape')
66
- config['shape']
67
- end
68
- end
69
-
70
- def instance_type
71
- "CpOraclecloud::JavaInstance"
72
- end
73
-
74
- def instance_name
75
- "service_name"
76
- end
77
-
78
- end
1
+ module CpOraclecloud
2
+ class JavaComponent < CloudComponent
3
+ include CpOraclecloud::JavaMixin
4
+
5
+ after_initialize :init
6
+ 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
7
+
8
+ enum edition: [:SE, :EE, :SUITE]
9
+ enum shape: [:oc3, :oc4, :oc5, :oc6, :oc1m, :oc2m, :oc3m, :oc4m]
10
+ enum level: [:PAAS, :BASIC]
11
+ enum subscription_type: [:HOURLY, :MONTHLY]
12
+ enum domain_mode: [:DEVELOPMENT, :PRODUCTION]
13
+
14
+ validates :service_name, :presence => true
15
+ validates :dba_name, :presence => true
16
+ validates :dba_password, :presence => true
17
+ validates :db_service_name, :presence => true
18
+ validates :shape, :presence => true
19
+ validates :version, :presence => true
20
+ validates :ssh_key, :presence => true
21
+ validates :admin_password, :presence => true
22
+ #validates_inclusion_of :num_nodes, :in => [1,2,4,8]
23
+ #validates :domain_partition_count, :inclusion => {:in => [0,1,2,4]}
24
+
25
+ validate :admin_password_complexity
26
+ validate :server_count_correct
27
+ validate :domain_partition_correct
28
+
29
+ def init
30
+ self.enable_admin_console ||= true
31
+ self.provision_otd ||= true
32
+ self.level ||= 'PAAS'
33
+ self.subscription_type ||= 'HOURLY'
34
+ self.edition ||= 'EE'
35
+ self.num_nodes ||= 1
36
+ end
37
+
38
+ def server_count_correct
39
+ if ![1,2,4,8].include?(num_nodes.to_i) then errors.add :num_nodes, "Invalid server count" end
40
+ end
41
+
42
+ def domain_partition_correct
43
+ if ![0,1,2,4].include?(domain_partition_count.to_i) then errors.add :domain_partition_count, "Invalid Domain Partition Count" end
44
+ end
45
+
46
+ def admin_password_complexity
47
+ if admin_password.size < 8 or admin_password.size > 30
48
+ errors.add :admin_password, "Must be at betweeen 8 and 30 characters long."
49
+ end
50
+ if !(admin_password[0] =~ /[[:alpha:]]/)
51
+ errors.add :admin_password, "First character must be a letter"
52
+ end
53
+ if (admin_password =~ /[a-z]/).blank? then errors.add :admin_password, 'Must contain a lower case letter' end
54
+ if (admin_password =~ /[A-Z]/).blank? then errors.add :admin_password, 'Must contain an upper case letter' end
55
+ if (admin_password =~ /[0-9]/).blank? then errors.add :admin_password, 'Must contain atleast one number' end
56
+ if (admin_password =~ /[-_#$]/).blank? then errors.add :admin_password, 'Must contain a special character (-, _, #, $)' end
57
+
58
+ end
59
+
60
+ def pretty_type
61
+ 'Oracle Java Cloud Service'
62
+ end
63
+
64
+ def pretty_size
65
+ if config && config.is_a?(Hash) && config.key?('shape')
66
+ config['shape']
67
+ end
68
+ end
69
+
70
+ def instance_type
71
+ "CpOraclecloud::JavaInstance"
72
+ end
73
+
74
+ def instance_name
75
+ "service_name"
76
+ end
77
+
78
+ end
79
79
  end