Class: Netscaler::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/netscaler/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, username, password = nil, nalias = nil, version = nil) ⇒ Configuration

Returns a new instance of Configuration.



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/netscaler/config.rb', line 65

def initialize(host, username, password=nil, nalias=nil, version=nil)
  @host = host
  @username = username
  @password = password
  @alias = nalias
  @version = if version
               version.to_s
             else
               "9.2"
             end

  query_password
end

Instance Attribute Details

#aliasObject (readonly)

Returns the value of attribute alias.



63
64
65
# File 'lib/netscaler/config.rb', line 63

def alias
  @alias
end

#hostObject (readonly)

Returns the value of attribute host.



63
64
65
# File 'lib/netscaler/config.rb', line 63

def host
  @host
end

#passwordObject (readonly)

Returns the value of attribute password.



63
64
65
# File 'lib/netscaler/config.rb', line 63

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



63
64
65
# File 'lib/netscaler/config.rb', line 63

def username
  @username
end

#versionObject (readonly)

Returns the value of attribute version.



63
64
65
# File 'lib/netscaler/config.rb', line 63

def version
  @version
end

Instance Method Details

#query_passwordObject



79
80
81
82
83
84
85
86
87
# File 'lib/netscaler/config.rb', line 79

def query_password
  if password.nil?
    @password = ask("Netscaler password for host #{host}: ") {|q| q.echo = false }
  end

  if password.nil? || password.empty?
    raise Netscaler::ConfigurationError.new("Unable to read the Netscaler password.")
  end
end