Class: Netscaler::VServer::Request

Inherits:
BaseRequest show all
Includes:
Logging
Defined in:
lib/netscaler/vserver/request.rb

Instance Attribute Summary

Attributes inherited from BaseRequest

#client

Instance Method Summary collapse

Methods included from Logging

configure, log, #log

Methods inherited from BaseRequest

#initialize

Constructor Details

This class inherits a constructor from Netscaler::BaseRequest

Instance Method Details

#bind(vserver, options) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/netscaler/vserver/request.rb', line 36

def bind(vserver, options)
  params = { 
    :name => vserver,
    :policyname => options[:policy],
    :priority => options[:Priority],
    :gotopriorityexpression => 'END' 
  }

  method = if options[:netscaler].version == "9.2"
             'bindlbvserver'
           else
             'bindlbvserver_policy'
           end
  send_request(method, params)
end

#disable(vserver, options) ⇒ Object



14
15
16
17
# File 'lib/netscaler/vserver/request.rb', line 14

def disable(vserver, options)
  params = { :name => vserver }
  send_request('disablelbvserver', params)
end

#enable(vserver, options) ⇒ Object



9
10
11
12
# File 'lib/netscaler/vserver/request.rb', line 9

def enable(vserver, options)
  params = { :name => vserver }
  send_request('enablelbvserver', params)
end

#list(vserver, options) {|vservers| ... } ⇒ Object

Yields:

  • (vservers)


19
20
21
22
23
24
25
26
27
# File 'lib/netscaler/vserver/request.rb', line 19

def list(vserver, options)
  vservers = []
  send_request('getlbvserver', {:empty => :ok}) do |response|
    response[:return][:list][:item].each do |vserver|
      vservers << Response.new(vserver).to_hash
    end
  end
  yield vservers if block_given?
end

#status(vserver, options) ⇒ Object



29
30
31
32
33
34
# File 'lib/netscaler/vserver/request.rb', line 29

def status(vserver, options)
  params = { :name => vserver }
  send_request('getlbvserver', params) do |response|
    yield Response.new(response).to_hash if block_given?
  end
end

#unbind(vserver, options) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/netscaler/vserver/request.rb', line 52

def unbind(vserver, options)
  params = {
    :name => vserver,
    :policyname => options[:policy], 
    :type => 'REQUEST'
  }

  method = if options[:netscaler].version == "9.2"
             'unbindlbvserver'
           else
             'unbindlbvserver_policy'
           end
  send_request(method, params)
end