Class: Fog::OracleCloud::Database::Instance
- Inherits:
-
Model
- Object
- Model
- Fog::OracleCloud::Database::Instance
- Defined in:
- lib/fog/oraclecloud/models/database/instance.rb
Instance Method Summary collapse
- #add_storage(size) ⇒ Object
- #backup ⇒ Object
- #backup_destination=(value) ⇒ Object
- #backups ⇒ Object
- #clean_name ⇒ Object
- #destroy ⇒ Object
- #disaster_recovery=(value) ⇒ Object
- #edition=(value) ⇒ Object
- #expand_storage(size, type = nil) ⇒ Object
- #failover_database=(value) ⇒ Object
- #get_snapshot(snapshot_name) ⇒ Object
- #ip_address ⇒ Object
- #is_rac=(value) ⇒ Object
- #level=(value) ⇒ Object
- #ncharset=(value) ⇒ Object
- #patches ⇒ Object
- #ready? ⇒ Boolean
- #recover(type, value) ⇒ Object
- #recover_latest ⇒ Object
- #recoveries ⇒ Object
- #save ⇒ Object
- #scale(shape) ⇒ Object
- #servers ⇒ Object
- #shape=(value) ⇒ Object
- #snapshots ⇒ Object
- #stopped? ⇒ Boolean
- #stopping? ⇒ Boolean
- #subscription_type=(value) ⇒ Object
- #usable_storage=(value) ⇒ Object
Instance Method Details
#add_storage(size) ⇒ Object
184 185 186 187 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 184 def add_storage(size) requires :service_name service.scale_instance(service_name, :additional_storage=>size).body end |
#backup ⇒ Object
211 212 213 214 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 211 def backup requires :service_name service.backup_instance(service_name) end |
#backup_destination=(value) ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 87 def backup_destination=(value) if %w(BOTH OSS NONE).include? value then attributes[:backup_destination]=value else raise ArgumentError, "Invalid backup destination. Valid values - BOTH, OSS or NONE" end end |
#backups ⇒ Object
216 217 218 219 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 216 def backups requires :service_name service.backups.all(service_name) end |
#clean_name ⇒ Object
148 149 150 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 148 def clean_name name.sub %r{\/.*\/}, '' end |
#destroy ⇒ Object
174 175 176 177 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 174 def destroy requires :service_name service.delete_instance(service_name).body end |
#disaster_recovery=(value) ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 95 def disaster_recovery=(value) if %w(yes no).include? value then attributes[:disaster_recovery]=value else raise ArgumentError, "Invalid disaster recovery value" end end |
#edition=(value) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 55 def edition=(value) if %w(SE EE EE_HP EE_EP).include? value then attributes[:edition]=value else raise ArgumentError, "Invalid Edition. Valid values - SE, EE, EE_HP, EE_EP" end end |
#expand_storage(size, type = nil) ⇒ Object
189 190 191 192 193 194 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 189 def (size, type=nil) requires :service_name if type.nil? then type = 'data' end if type == 'backup' then type ='fra' end service.scale_instance(service_name, :additional_storage=>size, :usage=>type).body end |
#failover_database=(value) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 103 def failover_database=(value) if value == true value = 'yes' elsif value == false || value.nil? value = 'no' end if %w(yes no).include? value then attributes[:failover_database]=value else raise ArgumentError, "Invalid failover database value" end end |
#get_snapshot(snapshot_name) ⇒ Object
201 202 203 204 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 201 def get_snapshot(snapshot_name) requires :service_name service.snapshots.get(service_name, snapshot_name) end |
#ip_address ⇒ Object
169 170 171 172 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 169 def ip_address # TODO: Replace with regex content_url.sub('http://', '') end |
#is_rac=(value) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 116 def is_rac=(value) if value == true value = 'yes' elsif value == false || value.nil? value = 'no' end if %w(yes no).include? value then attributes[:is_rac]=value else raise ArgumentError, "Invalid is_rac value" end end |
#level=(value) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 63 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 |
#ncharset=(value) ⇒ Object
129 130 131 132 133 134 135 136 137 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 129 def ncharset=(value) if value.nil? then attributes[:ncharset] = 'AL16UTF16' elsif %w(AL16UTF16 UTF8).include? value then attributes[:ncharset]=value else raise ArgumentError, "Invalid ncharset" end end |
#patches ⇒ Object
237 238 239 240 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 237 def patches requires :service_name service.patches.all(service_name) end |
#ready? ⇒ Boolean
157 158 159 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 157 def ready? status == "Running" end |
#recover(type, value) ⇒ Object
221 222 223 224 225 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 221 def recover(type, value) # Valid types are 'scn', 'tag' or 'timestamp' requires :service_name service.recover_instance(service_name, type, value) end |
#recover_latest ⇒ Object
227 228 229 230 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 227 def recover_latest requires :service_name service.recover_instance(service_name) end |
#recoveries ⇒ Object
232 233 234 235 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 232 def recoveries requires :service_name service.recoveries.all(service_name) end |
#save ⇒ Object
152 153 154 155 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 152 def save #identity ? update : create create end |
#scale(shape) ⇒ Object
179 180 181 182 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 179 def scale(shape) requires :service_name service.scale_instance(service_name, :shape=>shape).body end |
#servers ⇒ Object
206 207 208 209 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 206 def servers requires :service_name service.servers.all(service_name) end |
#shape=(value) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 71 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 |
#snapshots ⇒ Object
196 197 198 199 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 196 def snapshots requires :service_name service.snapshots.all(service_name) end |
#stopped? ⇒ Boolean
165 166 167 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 165 def stopped? status == 'Stopped' end |
#stopping? ⇒ Boolean
161 162 163 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 161 def stopping? status == 'Maintenance' || status == 'Terminating' end |
#subscription_type=(value) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 79 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 |
#usable_storage=(value) ⇒ Object
139 140 141 142 143 144 145 |
# File 'lib/fog/oraclecloud/models/database/instance.rb', line 139 def usable_storage=(value) if value.to_f >= 15 && value.to_f <= 1000 then attributes[:usable_storage]=value else raise ArgumentError, "Usable storage value is invalid: #{value.to_f}" end end |