Class: Netscaler::Connection
- Inherits:
-
Object
- Object
- Netscaler::Connection
- Defined in:
- lib/netscaler/connection.rb
Instance Method Summary collapse
- #adapter ⇒ Object
- #adapter=(value) ⇒ Object
- #cs ⇒ Object
- #ha ⇒ Object
-
#initialize(options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #lb ⇒ Object
- #load_balancing ⇒ Object
- #login ⇒ Object
- #logout ⇒ Object
- #policy ⇒ Object
- #responder ⇒ Object
- #rewrite ⇒ Object
- #server ⇒ Object
- #servers ⇒ Object
- #service ⇒ Object
- #servicegroup ⇒ Object
- #servicegroups ⇒ Object
- #session ⇒ Object
- #ssl ⇒ Object
- #system ⇒ Object
- #verify_ssl ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Connection
Returns a new instance of Connection.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/netscaler/connection.rb', line 23 def initialize(={}) =[] = Netscaler.hash_hack() [:username, :password, :hostname].each do |required_option| << required_option unless [required_option] != nil end raise ArgumentError, "Required options are missing. #{.join(', ')}" if .length > 0 @username = [:username] @password = [:password] @verify_ssl = [:verify_ssl].nil? ? true : [:verify_ssl] @adapter = HttpAdapter.new :hostname => "https://#{[:hostname]}", :username => @username, :password => @password, :verify_ssl => @verify_ssl @load_balancing = LoadBalancing.new self @service = Service.new self @servicegroups = ServiceGroup.new self @servers = Server.new self @policy = Policy.new self @lb = Lb.new self @cs = Cs.new self @rewrite = Rewrite.new self @responder = Responder.new self @ssl =Ssl.new self @system = System.new self @ha = Ha.new self end |
Instance Method Details
#adapter ⇒ Object
50 51 52 |
# File 'lib/netscaler/connection.rb', line 50 def adapter return @adapter end |
#adapter=(value) ⇒ Object
54 55 56 |
# File 'lib/netscaler/connection.rb', line 54 def adapter=(value) @adapter=value end |
#cs ⇒ Object
82 83 84 |
# File 'lib/netscaler/connection.rb', line 82 def cs @cs end |
#ha ⇒ Object
102 103 104 |
# File 'lib/netscaler/connection.rb', line 102 def ha @ha end |
#lb ⇒ Object
78 79 80 |
# File 'lib/netscaler/connection.rb', line 78 def lb @lb end |
#load_balancing ⇒ Object
70 71 72 |
# File 'lib/netscaler/connection.rb', line 70 def load_balancing return @load_balancing end |
#login ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/netscaler/connection.rb', line 122 def login() payload = { 'username' => @username, 'password' => @password } result = @adapter.post('config/login', { 'login' => payload}) @adapter.session = result['sessionid'] return @adapter.session end |
#logout ⇒ Object
133 134 135 |
# File 'lib/netscaler/connection.rb', line 133 def logout result = @adapter.post_no_body('config/logout', {'logout'=>{}}) end |
#policy ⇒ Object
74 75 76 |
# File 'lib/netscaler/connection.rb', line 74 def policy @policy end |
#responder ⇒ Object
94 95 96 |
# File 'lib/netscaler/connection.rb', line 94 def responder @responder end |
#rewrite ⇒ Object
90 91 92 |
# File 'lib/netscaler/connection.rb', line 90 def rewrite @rewrite end |
#server ⇒ Object
110 111 112 |
# File 'lib/netscaler/connection.rb', line 110 def server return @servers end |
#servers ⇒ Object
106 107 108 |
# File 'lib/netscaler/connection.rb', line 106 def servers return @servers end |
#service ⇒ Object
58 59 60 |
# File 'lib/netscaler/connection.rb', line 58 def service return @service end |
#servicegroup ⇒ Object
66 67 68 |
# File 'lib/netscaler/connection.rb', line 66 def servicegroup return @servicegroups end |
#servicegroups ⇒ Object
62 63 64 |
# File 'lib/netscaler/connection.rb', line 62 def servicegroups return @servicegroups end |
#session ⇒ Object
114 115 116 |
# File 'lib/netscaler/connection.rb', line 114 def session return @adapter.session end |
#ssl ⇒ Object
86 87 88 |
# File 'lib/netscaler/connection.rb', line 86 def ssl @ssl end |
#system ⇒ Object
98 99 100 |
# File 'lib/netscaler/connection.rb', line 98 def system @system end |
#verify_ssl ⇒ Object
118 119 120 |
# File 'lib/netscaler/connection.rb', line 118 def verify_ssl return @verify_ssl end |