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
- #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
- #servers ⇒ Object
- #shape=(value) ⇒ Object
- #stopped? ⇒ Boolean
- #stopping? ⇒ Boolean
- #subscription_type=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Instance
Returns a new instance of Instance.
145 146 147 148 149 150 151 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 145 def initialize(attributes={}) level ||= 'PAAS' subscription_type ||= 'HOURLY' edition ||= 'EE' super end |
Instance Method Details
#destroy ⇒ Object
174 175 176 177 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 174 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
126 127 128 129 130 131 132 133 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 126 def num_nodes=(value) if value.nil? then value = 1 end if [1, 2, 4, 8].include? value.to_i 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
158 159 160 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 158 def ready? status == "Running" end |
#save ⇒ Object
153 154 155 156 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 153 def save #identity ? update : create create end |
#servers ⇒ Object
170 171 172 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 170 def servers service.servers.all(service_name) end |
#shape=(value) ⇒ Object
135 136 137 138 139 140 141 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 135 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
166 167 168 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 166 def stopped? status == 'Stopped' end |
#stopping? ⇒ Boolean
162 163 164 |
# File 'lib/fog/oraclecloud/models/java/instance.rb', line 162 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 |