Class: Netscaler::Lb::Vserver

Inherits:
NetscalerService show all
Defined in:
lib/netscaler/lb/vserver.rb,
lib/netscaler/lb/vserver/bind.rb,
lib/netscaler/lb/vserver/unbind.rb

Defined Under Namespace

Classes: Bind, Unbind

Instance Method Summary collapse

Methods inherited from NetscalerService

#validate_payload

Constructor Details

#initialize(netscaler) ⇒ Vserver

Returns a new instance of Vserver.



6
7
8
# File 'lib/netscaler/lb/vserver.rb', line 6

def initialize(netscaler)
  @netscaler=netscaler
end

Instance Method Details

#add(payload) ⇒ Object

Raises:

  • (ArgumentError)


33
34
35
36
37
# File 'lib/netscaler/lb/vserver.rb', line 33

def add(payload)
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name, :serviceType, :ipv46, :port])
  return @netscaler.adapter.post_no_body('config/lbvserver/', {'lbvserver' => payload})
end

#bindObject



50
51
52
# File 'lib/netscaler/lb/vserver.rb', line 50

def bind
  Bind.new @netscaler
end

#remove(payload) ⇒ Object

:args: :name

Raises:

  • (ArgumentError)


27
28
29
30
31
# File 'lib/netscaler/lb/vserver.rb', line 27

def remove(payload) # :args: :name
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name])
  return @netscaler.adapter.delete("config/lbvserver/#{payload[:name]}")
end

#show(payload = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/netscaler/lb/vserver.rb', line 10

def show(payload={})
  if payload[:name] != nil then
    validate_payload(payload, [:name])
    return @netscaler.adapter.get("config/lbvserver/#{payload[:name]}")
  elsif payload == {} then
    return @netscaler.adapter.get('config/lbvserver/')
  else
    raise ArgumentError, 'payload supplied must have been missing :name'
  end
end

#show_binding(payload) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
# File 'lib/netscaler/lb/vserver.rb', line 21

def show_binding(payload)
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name])
  return @netscaler.adapter.get("config/lbvserver_binding/#{payload[:name]}")
end

#stat(payload = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/netscaler/lb/vserver.rb', line 39

def stat(payload={})
  if payload[:name] != nil then
    validate_payload(payload, [:name])
    return @netscaler.adapter.get("stat/lbvserver/#{payload[:name]}")
  elsif payload == {} then
    return @netscaler.adapter.get('stat/lbvserver')
  else
    raise ArgumentError, 'payload supplied must have been missing :name'
  end
end

#unbindObject



54
55
56
# File 'lib/netscaler/lb/vserver.rb', line 54

def unbind
  Unbind.new @netscaler
end