Class: Redshift::Client::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/redshift/client/configuration.rb

Constant Summary collapse

DEFAULT_SSL_MODE =
'allow'.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, user, password, dbname, sslmode) ⇒ Configuration

Returns a new instance of Configuration.



50
51
52
53
54
55
56
57
# File 'lib/redshift/client/configuration.rb', line 50

def initialize(host, port, user, password, dbname, sslmode)
  @host = host
  @port = port || 5439
  @user = user
  @password = password
  @dbname = dbname
  @sslmode = sslmode || DEFAULT_SSL_MODE
end

Instance Attribute Details

#dbnameObject (readonly)

Returns the value of attribute dbname.



8
9
10
# File 'lib/redshift/client/configuration.rb', line 8

def dbname
  @dbname
end

#hostObject (readonly)

Returns the value of attribute host.



8
9
10
# File 'lib/redshift/client/configuration.rb', line 8

def host
  @host
end

#passwordObject (readonly)

Returns the value of attribute password.



8
9
10
# File 'lib/redshift/client/configuration.rb', line 8

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



8
9
10
# File 'lib/redshift/client/configuration.rb', line 8

def port
  @port
end

#userObject (readonly)

Returns the value of attribute user.



8
9
10
# File 'lib/redshift/client/configuration.rb', line 8

def user
  @user
end

Class Method Details

.resolve(config = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/redshift/client/configuration.rb', line 13

def resolve(config = {})
  config.reverse_merge!(parse_redshift_url)

  Configuration.new(
    config[:host],
    config[:port],
    config[:user],
    config[:password],
    config[:dbname],
    config[:sslmode]
  )
end

Instance Method Details

#paramsObject



59
60
61
62
63
64
65
66
67
68
# File 'lib/redshift/client/configuration.rb', line 59

def params
  {
    host: @host,
    port: @port,
    user: @user,
    password: @password,
    dbname: @dbname,
    sslmode: @sslmode
  }
end