Class: Fog::OracleCloud::Java::Instance
- Inherits:
-
Model
- Object
- Model
- Fog::OracleCloud::Java::Instance
- Defined in:
- lib/fog/oraclecloud/models/java/instance.rb
Instance Method Summary collapse
- #access_rules ⇒ Object
- #destroy ⇒ Object
- #domain_mode=(value) ⇒ Object
- #edition=(value) ⇒ Object
-
#initialize(attributes = {}) ⇒ Instance
constructor
A new instance of Instance.
- #level=(value) ⇒ Object
- #num_nodes=(value) ⇒ Object
- #ready? ⇒ Boolean
- #save ⇒ Object
- #scale_out_a_cluster(cluster_name, create_cluster_if_missing) ⇒ Object
- #servers ⇒ Object
- #shape=(value) ⇒ Object
- #stopped? ⇒ Boolean
- #stopping? ⇒ Boolean
- #subscription_type=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Instance
Returns a new instance of Instance.
144 145 146 147 148 149 150 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 144 def initialize(attributes={}) level ||= 'PAAS' subscription_type ||= 'HOURLY' edition ||= 'EE' super end |
Instance Method Details
#access_rules ⇒ Object
173 174 175 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 173 def access_rules service.access_rules(:instance => self) end |
#destroy ⇒ Object
177 178 179 180 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 177 def destroy requires :service_name, :dba_name, :dba_password service.delete_instance(service_name, dba_name, dba_password, :force_delete => force_delete).body end |
#domain_mode=(value) ⇒ Object
108 109 110 111 112 113 114 115 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 108 def domain_mode=(value) if value.to_s == '' then value = 'DEVELOPMENT' end if %w(DEVELOPMENT PRODUCTION).include? value then attributes[:domain_mode]=value else raise ArgumentError, "Invalid domain mode '#{value}'. Valid values - DEVELOPMENT or PRODUCTION" end end |
#edition=(value) ⇒ Object
117 118 119 120 121 122 123 124 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 117 def edition=(value) if value.to_s == '' then value = 'EE' end if %w(SE EE SUITE).include? value then attributes[:edition]=value else raise ArgumentError, "Invalid edition. Valid values - SE, EE or SUITE" end end |
#level=(value) ⇒ Object
92 93 94 95 96 97 98 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 92 def level=(value) if %w(PAAS BASIC).include? value then attributes[:level]=value else raise ArgumentError, "Invalid level. Valid values - PAAS or BASIC" end end |
#num_nodes=(value) ⇒ Object
135 136 137 138 139 140 141 142 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 135 def num_nodes=(value) if value.nil? then value = 1 end if value.to_i.is_a? Integer then attributes[:num_nodes] = value.to_i else raise ArgumentError, "Invalid server count (#{value}). Valid values - 1, 2, 4 or 8" end end |
#ready? ⇒ Boolean
157 158 159 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 157 def ready? status == "Running" end |
#save ⇒ Object
152 153 154 155 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 152 def save #identity ? update : create create end |
#scale_out_a_cluster(cluster_name, create_cluster_if_missing) ⇒ Object
182 183 184 185 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 182 def scale_out_a_cluster(cluster_name, create_cluster_if_missing) requires :service_name service.scale_out_a_cluster(service_name, cluster_name, create_cluster_if_missing).body end |
#servers ⇒ Object
169 170 171 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 169 def servers service.servers.all(service_name) end |
#shape=(value) ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 127 def shape=(value) if %w(oc3 oc4 oc5 oc6 oc1m oc2m oc3m oc4m).include? value then attributes[:shape]=value else raise ArgumentError, "Invalid Shape. Valid values - oc3, oc4, oc5, oc6, oc1m, oc2m, oc3m or oc4m" end end |
#stopped? ⇒ Boolean
165 166 167 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 165 def stopped? status == 'Stopped' end |
#stopping? ⇒ Boolean
161 162 163 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 161 def stopping? status == 'Maintenance' || status == 'Terminating' end |
#subscription_type=(value) ⇒ Object
100 101 102 103 104 105 106 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 100 def subscription_type=(value) if %w(HOURLY MONTHLY).include? value then attributes[:subscription_type]=value else raise ArgumentError, "Invalid subscription type. Valid values - HOURLY or MONTHLY" end end |