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
- #admin_password=(value) ⇒ 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
- #service_name=(value) ⇒ 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
| 200 201 202 203 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 200 def add_storage(size) requires :service_name service.scale_instance(service_name, :additional_storage=>size).body end | 
#admin_password=(value) ⇒ Object
| 155 156 157 158 159 160 161 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 155 def admin_password=(value) if !value.nil? and (!(value[0] =~ /[[:alpha:]]/) or value.size < 8 or value.size > 30 or !(value =~ /[_#$]/) or !(value =~ /[0-9]/)) raise ArgumentError, "Invalid admin password. Password must be between 8 and 30 characters in length; must start with a letter and can only contain letters, numbers and $, \#, _" else attributes[:admin_password] = value end end | 
#backup ⇒ Object
| 227 228 229 230 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 227 def backup requires :service_name service.backup_instance(service_name) end | 
#backup_destination=(value) ⇒ Object
| 95 96 97 98 99 100 101 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 95 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
| 232 233 234 235 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 232 def backups requires :service_name service.backups.all(service_name) end | 
#clean_name ⇒ Object
| 164 165 166 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 164 def clean_name name.sub %r{\/.*\/}, '' end | 
#destroy ⇒ Object
| 190 191 192 193 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 190 def destroy requires :service_name service.delete_instance(service_name).body end | 
#disaster_recovery=(value) ⇒ Object
| 103 104 105 106 107 108 109 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 103 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
| 63 64 65 66 67 68 69 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 63 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
| 205 206 207 208 209 210 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 205 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
| 111 112 113 114 115 116 117 118 119 120 121 122 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 111 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
| 217 218 219 220 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 217 def get_snapshot(snapshot_name) requires :service_name service.snapshots.get(service_name, snapshot_name) end | 
#ip_address ⇒ Object
| 185 186 187 188 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 185 def ip_address # TODO: Replace with regex content_url.sub('http://', '') end | 
#is_rac=(value) ⇒ Object
| 124 125 126 127 128 129 130 131 132 133 134 135 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 124 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
| 71 72 73 74 75 76 77 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 71 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
| 137 138 139 140 141 142 143 144 145 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 137 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
| 253 254 255 256 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 253 def patches requires :service_name service.patches.all(service_name) end | 
#ready? ⇒ Boolean
| 173 174 175 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 173 def ready? status == "Running" end | 
#recover(type, value) ⇒ Object
| 237 238 239 240 241 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 237 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
| 243 244 245 246 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 243 def recover_latest requires :service_name service.recover_instance(service_name) end | 
#recoveries ⇒ Object
| 248 249 250 251 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 248 def recoveries requires :service_name service.recoveries.all(service_name) end | 
#save ⇒ Object
| 168 169 170 171 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 168 def save #identity ? update : create create end | 
#scale(shape) ⇒ Object
| 195 196 197 198 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 195 def scale(shape) requires :service_name service.scale_instance(service_name, :shape=>shape).body end | 
#servers ⇒ Object
| 222 223 224 225 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 222 def servers requires :service_name service.servers.all(service_name) end | 
#service_name=(value) ⇒ Object
| 55 56 57 58 59 60 61 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 55 def service_name=(value) if value.include? '_' raise ArgumentError, "Invalid service name. Names must be less than 50 characters; must start with a letter and can only contain letters, numbers and hyphens (-); can not end with a hyphen" else attributes[:service_name] = value end end | 
#shape=(value) ⇒ Object
| 79 80 81 82 83 84 85 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 79 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
| 212 213 214 215 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 212 def snapshots requires :service_name service.snapshots.all(service_name) end | 
#stopped? ⇒ Boolean
| 181 182 183 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 181 def stopped? status == 'Stopped' end | 
#stopping? ⇒ Boolean
| 177 178 179 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 177 def stopping? status == 'Maintenance' || status == 'Terminating' end | 
#subscription_type=(value) ⇒ Object
| 87 88 89 90 91 92 93 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 87 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
| 147 148 149 150 151 152 153 | # File 'lib/fog/oraclecloud/models/database/instance.rb', line 147 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 |