Class: Database
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from FogModel
#id, #initialize, #method_missing, #wait_until_ready
Constructor Details
This class inherits a constructor from FogModel
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class FogModel
Class Method Details
.create!(name, size, password) ⇒ Object
3
4
5
6
7
8
9
10
11
12
|
# File 'lib/dew/models/database.rb', line 3
def self.create! name, size, password
new Cloud.rds.servers.create(
:engine => 'MySQL',
:master_username => 'root',
:password => password,
:id => name,
:allocated_storage => '5',
:flavor_id => size
)
end
|
.get(name) ⇒ Object
14
15
16
17
|
# File 'lib/dew/models/database.rb', line 14
def self.get name
db = Cloud.rds.servers.get(name)
new db if db
end
|
Instance Method Details
#db_environment_file(password) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/dew/models/database.rb', line 23
def db_environment_file password
"DB_HOST=\#{fog_object.endpoint['Address']}\nDB_NAME=\#{id}\nDB_USERNAME=\#{master_username}\nDB_PASSWORD=\#{password}\n EOF\nend\n"
|
#public_address ⇒ Object
19
20
21
|
# File 'lib/dew/models/database.rb', line 19
def public_address
fog_object.endpoint['Address']
end
|