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,37 +1,37 @@
1
- <dl class="dl-horizontal">
2
- <% ['description', 'status', 'shape', 'level', 'edition', 'version', 'service_uri'].each { |a| %>
3
- <% if instance.attr_get(a).present? then %>
4
- <dt><%= a.titleize() %></dt>
5
- <dd><%= instance.attr_get(a) %></dd>
6
- <% end %>
7
- <% } %>
8
- </dl>
9
-
10
- <ul class="nav nav-tabs">
11
- <li role="presentation" class="active"><a href="#servers" data-toggle="tab">Servers</a></li>
12
- </ul>
13
-
14
- <div class="tab-content ">
15
- <div class="tab-pane active" id="servers">
16
- <table class="table table-striped table-hover">
17
- <thead>
18
- <tr>
19
- <th>Hostname</th>
20
- <th>Status</th>
21
- <th>Shape</th>
22
- <th></th>
23
- </tr>
24
- </thead>
25
- <tbody>
26
- <% instance.fog.servers.each {|i| %>
27
- <tr>
28
- <td><%= i.hostname %></td>
29
- <td><%= i.status %></td>
30
- <td><%= i.shape %></td>
31
- <td></td>
32
- </tr>
33
- <% } %>
34
- </tbody>
35
- </table>
36
- </div>
1
+ <dl class="dl-horizontal">
2
+ <% ['description', 'status', 'shape', 'level', 'edition', 'version', 'service_uri'].each { |a| %>
3
+ <% if instance.attr_get(a).present? then %>
4
+ <dt><%= a.titleize() %></dt>
5
+ <dd><%= instance.attr_get(a) %></dd>
6
+ <% end %>
7
+ <% } %>
8
+ </dl>
9
+
10
+ <ul class="nav nav-tabs">
11
+ <li role="presentation" class="active"><a href="#servers" data-toggle="tab">Servers</a></li>
12
+ </ul>
13
+
14
+ <div class="tab-content ">
15
+ <div class="tab-pane active" id="servers">
16
+ <table class="table table-striped table-hover">
17
+ <thead>
18
+ <tr>
19
+ <th>Hostname</th>
20
+ <th>Status</th>
21
+ <th>Shape</th>
22
+ <th></th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <% instance.fog.servers.each {|i| %>
27
+ <tr>
28
+ <td><%= i.hostname %></td>
29
+ <td><%= i.status %></td>
30
+ <td><%= i.shape %></td>
31
+ <td></td>
32
+ </tr>
33
+ <% } %>
34
+ </tbody>
35
+ </table>
36
+ </div>
37
37
  </div>
@@ -1,37 +1,37 @@
1
- <em>Required fields are on the General tab. 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
- </ul>
8
-
9
-
10
- <div class="tab-content ">
11
- <div class="tab-pane active" id="general">
12
- <%= f.input :service_name %>
13
- <%= f.input :description %>
14
- <%= f.input :topology %>
15
- <%= f.input :shape %>
16
- <%= f.input :num_nodes, label: 'Managed Server Count', as: :integer, hint: 'Valid values: 1, 2, 4, 8' %>
17
- <%= f.input :version %>
18
- <%= f.input :ssh_key %>
19
- <%= f.input :admin_username %>
20
- <%= f.input :admin_password, input_html: { value: @component.admin_password } %>
21
- </div>
22
- <div class="tab-pane" id="storage">
23
- <em>If you leave these blank, the system will create a storage container with the name '%service_name%_backup'</em>
24
- <%= f.input :cloud_storage_container %>
25
- <%= f.input :cloud_storage_user %>
26
- <%= f.input :cloud_storage_pwd, input_html: { value: @component.cloud_storage_pwd }%>
27
- </div>
28
- <div class="tab-pane" id="database">
29
- <em>If you leave these blank, the system will create a Enterprise Edition (12.1.0.2) Database of size 'oc3' with the name '%service_name%-DB'</em>
30
- <%= f.input :db_service_name %>
31
- <%= f.input :dba_name %>
32
- <%= f.input :dba_password, input_html: { value: @component.dba_password }%>
33
- </div>
34
- <div class="tab-pane" id="networking">
35
- <%= f.input :provision_otd, as: :boolean %>
36
- </div>
1
+ <em>Required fields are on the General tab. 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
+ </ul>
8
+
9
+
10
+ <div class="tab-content ">
11
+ <div class="tab-pane active" id="general">
12
+ <%= f.input :service_name %>
13
+ <%= f.input :description %>
14
+ <%= f.input :topology %>
15
+ <%= f.input :shape %>
16
+ <%= f.input :num_nodes, label: 'Managed Server Count', as: :integer, hint: 'Valid values: 1, 2, 4, 8' %>
17
+ <%= f.input :version %>
18
+ <%= f.input :ssh_key %>
19
+ <%= f.input :admin_username %>
20
+ <%= f.input :admin_password, input_html: { value: @component.admin_password } %>
21
+ </div>
22
+ <div class="tab-pane" id="storage">
23
+ <em>If you leave these blank, the system will create a storage container with the name '%service_name%_backup'</em>
24
+ <%= f.input :cloud_storage_container %>
25
+ <%= f.input :cloud_storage_user %>
26
+ <%= f.input :cloud_storage_pwd, input_html: { value: @component.cloud_storage_pwd }%>
27
+ </div>
28
+ <div class="tab-pane" id="database">
29
+ <em>If you leave these blank, the system will create a Enterprise Edition (12.1.0.2) Database of size 'oc3' with the name '%service_name%-DB'</em>
30
+ <%= f.input :db_service_name %>
31
+ <%= f.input :dba_name %>
32
+ <%= f.input :dba_password, input_html: { value: @component.dba_password }%>
33
+ </div>
34
+ <div class="tab-pane" id="networking">
35
+ <%= f.input :provision_otd, as: :boolean %>
36
+ </div>
37
37
  </div>
@@ -1,8 +1,8 @@
1
- <dl class="dl-horizontal">
2
- <% ['description', 'status', 'shape', 'level', 'edition', 'version', 'service_uri'].each { |a| %>
3
- <% if instance.attr_get(a).present? then %>
4
- <dt><%= a.titleize() %></dt>
5
- <dd><%= instance.attr_get(a) %></dd>
6
- <% end %>
7
- <% } %>
8
- </dl>
1
+ <dl class="dl-horizontal">
2
+ <% ['description', 'status', 'shape', 'level', 'edition', 'version', 'service_uri'].each { |a| %>
3
+ <% if instance.attr_get(a).present? then %>
4
+ <dt><%= a.titleize() %></dt>
5
+ <dd><%= instance.attr_get(a) %></dd>
6
+ <% end %>
7
+ <% } %>
8
+ </dl>
@@ -1,8 +1,8 @@
1
- <%= simple_form_for(ssh_key) do |f| %>
2
-
3
- <%= f.input :name %>
4
- <%= f.input :enabled, as: :boolean %>
5
- <%= f.input :key, as: :text %>
6
-
7
- <%= f.button :submit, class: "btn-primary" %>
8
- <% end %>
1
+ <%= simple_form_for(ssh_key) do |f| %>
2
+
3
+ <%= f.input :name %>
4
+ <%= f.input :enabled, as: :boolean %>
5
+ <%= f.input :key, as: :text %>
6
+
7
+ <%= f.button :submit, class: "btn-primary" %>
8
+ <% end %>
@@ -1,4 +1,4 @@
1
- <header>
2
- <h1>Edit SSH Key</h1>
3
- </header>
1
+ <header>
2
+ <h1>Edit SSH Key</h1>
3
+ </header>
4
4
  <%= render "form", ssh_key: @ssh_key %>
@@ -1,34 +1,34 @@
1
- <header>
2
- <h1>SSH Keys</h1>
3
-
4
- <ul class="actions">
5
- <% if policy(CpOraclecloud::SshKey).new? %>
6
- <li><%= link_to "New SSH Key", new_cp_oraclecloud_ssh_key_path,
7
- class: "new" %></li>
8
- <% end %>
9
- </ul>
10
-
11
- </header>
12
-
13
- <div id="ssh_keys">
14
- <table class="table table-striped table-hover">
15
- <thead>
16
- <tr>
17
- <th>Name</th>
18
- <th>Enabled</th>
19
- <th>Actions</th>
20
- </tr>
21
- </thead>
22
- <tbody>
23
- <% @ssh_keys.each do |key| %>
24
- <tr>
25
- <td><%= key.name %></td>
26
- <td><%= key.enabled %></td>
27
- <td><%= link_to "", key, method: :delete,
28
- data: { confirm: "Are you sure you want to delete this SSH Key? This will remove it from the cloud."},
29
- class: "delete" %></td>
30
- </tr>
31
- <% end %>
32
- </tbody>
33
- </table>
1
+ <header>
2
+ <h1>SSH Keys</h1>
3
+
4
+ <ul class="actions">
5
+ <% if policy(CpOraclecloud::SshKey).new? %>
6
+ <li><%= link_to "New SSH Key", new_cp_oraclecloud_ssh_key_path,
7
+ class: "new" %></li>
8
+ <% end %>
9
+ </ul>
10
+
11
+ </header>
12
+
13
+ <div id="ssh_keys">
14
+ <table class="table table-striped table-hover">
15
+ <thead>
16
+ <tr>
17
+ <th>Name</th>
18
+ <th>Enabled</th>
19
+ <th>Actions</th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <% @ssh_keys.each do |key| %>
24
+ <tr>
25
+ <td><%= key.name %></td>
26
+ <td><%= key.enabled %></td>
27
+ <td><%= link_to "", key, method: :delete,
28
+ data: { confirm: "Are you sure you want to delete this SSH Key? This will remove it from the cloud."},
29
+ class: "delete" %></td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
34
34
  </div>
@@ -1,4 +1,4 @@
1
- <header>
2
- <h1>Create SSH Key</h1>
3
- </header>
1
+ <header>
2
+ <h1>Create SSH Key</h1>
3
+ </header>
4
4
  <%= render "form", ssh_key: @ssh_key %>
@@ -1,17 +1,17 @@
1
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Oracle Cloud Platform<span class="caret"></span>
2
- </button>
3
- <ul class="dropdown-menu">
4
- <% CpOraclecloud.active_components.each do | comp | %>
5
- <li>
6
- <% if comp == 'Database' %>
7
- <%= link_to "Create Database", [@product, CpOraclecloud::DatabaseComponent, action: :new]%>
8
- <% elsif comp == 'Java' %>
9
- <%= link_to "Create WebLogic", [@product, CpOraclecloud::JavaComponent, action: :new]%>
10
- <% elsif comp == 'SOA' %>
11
- <%= link_to "Create SOA Instance", [@product, CpOraclecloud::SoaComponent, action: :new]%>
12
- <% elsif comp == 'Compute' %>
13
- <%= link_to "Create Compute Instance", [@product, CpOraclecloud::ComputeComponent, action: :new] %>
14
- <% end %>
15
- </li>
16
- <% end %>
17
- </ul>
1
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Oracle Cloud Platform<span class="caret"></span>
2
+ </button>
3
+ <ul class="dropdown-menu">
4
+ <% CpOraclecloud.active_components.each do | comp | %>
5
+ <li>
6
+ <% if comp == 'Database' %>
7
+ <%= link_to "Create Database", [@product, CpOraclecloud::DatabaseComponent, action: :new]%>
8
+ <% elsif comp == 'Java' %>
9
+ <%= link_to "Create WebLogic", [@product, CpOraclecloud::JavaComponent, action: :new]%>
10
+ <% elsif comp == 'SOA' %>
11
+ <%= link_to "Create SOA Instance", [@product, CpOraclecloud::SoaComponent, action: :new]%>
12
+ <% elsif comp == 'Compute' %>
13
+ <%= link_to "Create Compute Instance", [@product, CpOraclecloud::ComputeComponent, action: :new] %>
14
+ <% end %>
15
+ </li>
16
+ <% end %>
17
+ </ul>
data/config/routes.rb CHANGED
@@ -1,22 +1,22 @@
1
- Rails.application.routes.draw do
2
- resources :products do
3
- namespace :cp_oraclecloud do
4
- resources :database_components, type: 'CpOraclecloud::DatabaseComponent'
5
- resources :java_components, type: 'CpOraclecloud::JavaComponent'
6
- resources :soa_components, type: 'CpOraclecloud::SoaComponent'
7
- resources :compute_components, type: 'CpOraclecloud::ComputeComponent'
8
- end
9
- end
10
-
11
- namespace :cp_oraclecloud do
12
- resources :database_instances, type: 'CpOraclecloud::DatabaseInstance' do
13
- put :backup
14
- end
15
- resources :java_instances, type: 'CpOraclecloud::JavaInstance' do
16
- put :backup
17
- end
18
- resources :soa_instances, type: 'CpOraclecloud::SoaInstance'
19
- resources :compute_instances, type: 'CpOraclecloud::SoaInstance'
20
- resources :ssh_keys
21
- end
22
- end
1
+ Rails.application.routes.draw do
2
+ resources :products do
3
+ namespace :cp_oraclecloud do
4
+ resources :database_components, type: 'CpOraclecloud::DatabaseComponent'
5
+ resources :java_components, type: 'CpOraclecloud::JavaComponent'
6
+ resources :soa_components, type: 'CpOraclecloud::SoaComponent'
7
+ resources :compute_components, type: 'CpOraclecloud::ComputeComponent'
8
+ end
9
+ end
10
+
11
+ namespace :cp_oraclecloud do
12
+ resources :database_instances, type: 'CpOraclecloud::DatabaseInstance' do
13
+ put :backup
14
+ end
15
+ resources :java_instances, type: 'CpOraclecloud::JavaInstance' do
16
+ put :backup
17
+ end
18
+ resources :soa_instances, type: 'CpOraclecloud::SoaInstance'
19
+ resources :compute_instances, type: 'CpOraclecloud::SoaInstance'
20
+ resources :ssh_keys
21
+ end
22
+ end
@@ -1,24 +1,22 @@
1
- require "cp_oraclecloud/engine"
2
-
3
- module CpOraclecloud
4
- extend ActiveSupport::Autoload
5
-
6
- mattr_accessor :username
7
- mattr_accessor :password
8
- mattr_accessor :domain
9
- mattr_accessor :compute_api
10
- mattr_accessor :storage_api
11
- mattr_accessor :region
12
- mattr_accessor :active_components
13
- mattr_accessor :rate_card
14
-
15
- autoload :DatabaseMixin
16
- autoload :JavaMixin
17
- autoload :SoaMixin
18
- autoload :ComputeMixin
19
-
20
- def self.setup
21
- yield self
22
- end
23
- end
1
+ require "cp_oraclecloud/engine"
2
+
3
+ module CpOraclecloud
4
+ extend ActiveSupport::Autoload
5
+
6
+ mattr_accessor :username
7
+ mattr_accessor :password
8
+ mattr_accessor :domain
9
+ mattr_accessor :compute_api
10
+ mattr_accessor :storage_api
11
+ mattr_accessor :region
12
+ mattr_accessor :active_components
13
+ mattr_accessor :rate_card
14
+
15
+ autoload :DatabaseMixin
16
+ autoload :JavaMixin
17
+ autoload :SoaMixin
18
+ autoload :ComputeMixin
19
+
20
+
21
+ end
24
22
 
@@ -1,7 +1,7 @@
1
- module CpOraclecloud
2
- module ComputeMixin
3
- def calculate_monthly_cost(config)
4
- CpOraclecloud.rate_card[:compute]['hourly'] * 24 * 30
5
- end
6
- end
7
- end
1
+ module CpOraclecloud
2
+ module ComputeMixin
3
+ def calculate_monthly_cost(config)
4
+ CpOraclecloud.rate_card[:compute]['hourly'] * 24 * 30
5
+ end
6
+ end
7
+ end
@@ -1,27 +1,27 @@
1
- module CpOraclecloud
2
- module DatabaseMixin
3
- def calculate_monthly_cost(config)
4
- cost = 0
5
- if %w(oc3 oc4 oc5 oc6).include? config['shape']
6
- # General Compute
7
- rates = CpOraclecloud.rate_card[:database]['general']
8
- else
9
- # High Memory
10
- rates = CpOraclecloud.rate_card[:database]['high']
11
- end
12
- case config['edition']
13
- when 'SE'
14
- edition_rate = rates['standard']
15
- when 'EE'
16
- edition_rate = rates['enterprise']
17
- when 'EE_HP'
18
- edition_rate = rates['hp']
19
- when 'EE_XP'
20
- edition_rate = rates['xp']
21
- end
22
- if config['subscription_type'] == 'MONTHLY' then cost = edition_rate['monthly']
23
- else cost = 30 * 24 * edition_rate['hourly'] end
24
- cost
25
- end
26
- end
1
+ module CpOraclecloud
2
+ module DatabaseMixin
3
+ def calculate_monthly_cost(config)
4
+ cost = 0
5
+ if %w(oc3 oc4 oc5 oc6).include? config['shape']
6
+ # General Compute
7
+ rates = CpOraclecloud.rate_card[:database]['general']
8
+ else
9
+ # High Memory
10
+ rates = CpOraclecloud.rate_card[:database]['high']
11
+ end
12
+ case config['edition']
13
+ when 'SE'
14
+ edition_rate = rates['standard']
15
+ when 'EE'
16
+ edition_rate = rates['enterprise']
17
+ when 'EE_HP'
18
+ edition_rate = rates['hp']
19
+ when 'EE_XP'
20
+ edition_rate = rates['xp']
21
+ end
22
+ if config['subscription_type'] == 'MONTHLY' then cost = edition_rate['monthly']
23
+ else cost = 30 * 24 * edition_rate['hourly'] end
24
+ cost
25
+ end
26
+ end
27
27
  end