Class: Fog::Rackspace::Databases::Instance
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::Databases::Instance
show all
- Defined in:
- lib/fog/rackspace/models/databases/instance.rb
Constant Summary
collapse
- ACTIVE =
'ACTIVE'
- BUILD =
'BUILD'
- BLOCKED =
'BLOCKED'
- REBOOT =
'REBOOT'
- RESIZE =
'RESIZE'
- SHUTDOWN =
'SHUTDOWN'
Instance Attribute Summary collapse
Attributes inherited from Model
#collection, #service
Instance Method Summary
collapse
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#connection, #connection=, #prepare_service_value
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
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
|
#users ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'lib/fog/rackspace/models/databases/instance.rb', line 55
def users
@users ||= begin
Fog::Rackspace::Databases::Users.new({
:service => service,
:instance => self
})
end
end
|