Class: Chef::Resource::DatabaseUser

Inherits:
Database show all
Defined in:
lib/cookbooks/database/libraries/resource_database_user.rb

Instance Method Summary collapse

Methods inherited from Database

#collation, #connection, #connection_limit, #encoding, #owner, #sql, #sql_query, #tablespace, #template

Constructor Details

#initialize(name, run_context = nil) ⇒ DatabaseUser

Returns a new instance of DatabaseUser.



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cookbooks/database/libraries/resource_database_user.rb', line 25

def initialize(name, run_context=nil)
  super
  @resource_name = :database_user
  @username = name

  @database_name = nil
  @table = nil
  @host = 'localhost'
  @privileges = [:all]

  @allowed_actions.push(:create, :drop, :grant)
  @action = :create
end

Instance Method Details

#database_name(arg = nil) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/cookbooks/database/libraries/resource_database_user.rb', line 39

def database_name(arg=nil)
  set_or_return(
    :database_name,
    arg,
    :kind_of => String
  )
end

#host(arg = nil) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/cookbooks/database/libraries/resource_database_user.rb', line 72

def host(arg=nil)
  set_or_return(
    :host,
    arg,
    :kind_of => String
  )
end

#password(arg = nil) ⇒ Object



55
56
57
58
59
60
61
62
# File 'lib/cookbooks/database/libraries/resource_database_user.rb', line 55

def password(arg=nil)
  set_or_return(
    :password,
    arg,
    :kind_of => String,
    :required => true
  )
end

#privileges(arg = nil) ⇒ Object



80
81
82
83
84
85
86
# File 'lib/cookbooks/database/libraries/resource_database_user.rb', line 80

def privileges(arg=nil)
  set_or_return(
    :privileges,
    arg,
    :kind_of => Array
  )
end

#table(arg = nil) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/cookbooks/database/libraries/resource_database_user.rb', line 64

def table(arg=nil)
  set_or_return(
    :table,
    arg,
    :kind_of => String
  )
end

#username(arg = nil) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/cookbooks/database/libraries/resource_database_user.rb', line 47

def username(arg=nil)
  set_or_return(
    :username,
    arg,
    :kind_of => String
  )
end