Class: Fog::Rackspace::Databases::Instance
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::Databases::Instance
- Defined in:
- lib/fog/rackspace/models/databases/instance.rb
Constant Summary collapse
- ACTIVE =
States
'ACTIVE'
- BUILD =
'BUILD'
- BLOCKED =
'BLOCKED'
- REBOOT =
'REBOOT'
- RESIZE =
'RESIZE'
- SHUTDOWN =
'SHUTDOWN'
Instance Attribute Summary collapse
-
#root_password ⇒ Object
Returns the value of attribute root_password.
-
#root_user ⇒ Object
Returns the value of attribute root_user.
Instance Method Summary collapse
- #databases ⇒ Object
- #destroy ⇒ Object
- #enable_root_user ⇒ Object
- #flavor ⇒ Object
- #ready? ⇒ Boolean
- #resize(flavor_id) ⇒ Object
- #resize_volume(volume_size) ⇒ Object
- #restart ⇒ Object
- #root_user_enabled? ⇒ Boolean
- #save ⇒ Object
- #users ⇒ Object
Instance Attribute Details
#root_password ⇒ Object
Returns the value of attribute root_password.
26 27 28 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 26 def root_password @root_password end |
#root_user ⇒ Object
Returns the value of attribute root_user.
26 27 28 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 26 def root_user @root_user end |
Instance Method Details
#databases ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 46 def databases @databases ||= begin Fog::Rackspace::Databases::Databases.new({ :service => service, :instance => self }) end end |
#destroy ⇒ Object
35 36 37 38 39 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 35 def destroy requires :identity service.delete_instance(identity) true end |
#enable_root_user ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 73 def enable_root_user requires :identity data = service.enable_root_user(identity).body['user'] @root_user = data['name'] @root_password = data['password'] true end |
#flavor ⇒ Object
41 42 43 44 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 41 def flavor requires :flavor_id @flavor ||= service.flavors.get(flavor_id) end |
#ready? ⇒ Boolean
64 65 66 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 64 def ready? state == ACTIVE end |
#resize(flavor_id) ⇒ Object
88 89 90 91 92 93 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 88 def resize(flavor_id) requires :identity service.resize_instance(identity, flavor_id) self.state = RESIZE true end |
#resize_volume(volume_size) ⇒ Object
95 96 97 98 99 100 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 95 def resize_volume(volume_size) requires :identity service.resize_instance_volume(identity, volume_size) self.state = RESIZE true end |
#restart ⇒ Object
81 82 83 84 85 86 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 81 def restart requires :identity service.restart_instance(identity) self.state = REBOOT true end |
#root_user_enabled? ⇒ Boolean
68 69 70 71 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 68 def root_user_enabled? requires :identity service.check_root_user(identity).body['rootEnabled'] end |
#save ⇒ Object
28 29 30 31 32 33 |
# File 'lib/fog/rackspace/models/databases/instance.rb', line 28 def save requires :name, :flavor_id, :volume_size data = service.create_instance(name, flavor_id, volume_size) merge_attributes(data.body['instance']) true end |