2012-04-26 19:04:20 -04:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Rackspace
|
|
|
|
class Databases
|
|
|
|
class User < Fog::Model
|
|
|
|
identity :name
|
2012-06-21 17:47:52 -04:00
|
|
|
|
|
|
|
attribute :password
|
|
|
|
attribute :databases
|
2014-08-13 14:22:23 -04:00
|
|
|
attribute :host
|
|
|
|
|
|
|
|
def initialize(params = {})
|
|
|
|
super
|
|
|
|
end
|
2012-06-21 17:47:52 -04:00
|
|
|
|
|
|
|
def save
|
|
|
|
requires :identity, :instance, :password
|
2012-12-22 18:24:03 -05:00
|
|
|
service.create_user(instance.identity, identity, password, :databases => databases)
|
2012-06-21 17:47:52 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
requires :identity, :instance
|
2012-12-22 18:24:03 -05:00
|
|
|
service.delete_user(instance.identity, identity)
|
2012-06-21 17:47:52 -04:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def instance
|
|
|
|
collection.instance
|
|
|
|
end
|
2012-04-26 19:04:20 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|