Class: Fog::Brightbox::Compute::DatabaseServer
- Inherits:
-
Model
- Object
- Model
- Model
- Fog::Brightbox::Compute::DatabaseServer
show all
- Includes:
- ResourceLocking
- Defined in:
- lib/fog/brightbox/models/compute/database_server.rb
Instance Method Summary
collapse
#lock!, #locked?, #unlock!
#collection_name, #resource_name
Instance Method Details
#destroy ⇒ Object
92
93
94
95
96
|
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 92
def destroy
requires :identity
merge_attributes(service.delete_database_server(identity))
true
end
|
#ready? ⇒ Boolean
75
76
77
|
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 75
def ready?
state == "active"
end
|
#reset ⇒ Object
98
99
100
101
102
|
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 98
def reset
requires :identity
merge_attributes(service.reset_database_server(identity))
true
end
|
#reset_password ⇒ Object
104
105
106
107
108
|
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 104
def reset_password
requires :identity
merge_attributes(service.reset_password_database_server(identity))
true
end
|
#resize(new_type) ⇒ Object
110
111
112
113
114
|
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 110
def resize(new_type)
requires :identity
merge_attributes(service.resize_database_server(identity, new_type: new_type))
true
end
|
#save ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 45
def save
options = {
name: name,
description: description
}
options[:allow_access] = allow_access if allow_access
options[:maintenance_weekday] = maintenance_weekday
options[:maintenance_hour] = maintenance_hour
options[:snapshots_schedule] = snapshots_schedule
options[:snapshots_schedule] = nil if snapshots_schedule == ""
if persisted?
data = update_database_server(options)
else
options[:engine] = database_engine if database_engine
options[:version] = database_version if database_version
options[:database_type] = flavor_id if flavor_id
options[:zone] = zone_id if zone_id
options[:snapshot] = snapshot_id if snapshot_id
data = create_database_server(options)
end
merge_attributes(data)
true
end
|
#snapshot(return_snapshot = false) ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/fog/brightbox/models/compute/database_server.rb', line 79
def snapshot(return_snapshot = false)
requires :identity
response, snapshot_id = service.snapshot_database_server(identity, return_link: return_snapshot)
merge_attributes(response)
if return_snapshot
service.database_snapshots.get(snapshot_id)
else
true
end
end
|