Class: Netscaler::Cs::Vserver::Bind

Inherits:
NetscalerService show all
Defined in:
lib/netscaler/cs/vserver/bind.rb

Instance Method Summary collapse

Methods inherited from NetscalerService

#validate_payload

Constructor Details

#initialize(netscaler) ⇒ Bind

Returns a new instance of Bind.



5
6
7
# File 'lib/netscaler/cs/vserver/bind.rb', line 5

def initialize(netscaler)
  @netscaler=netscaler
end

Instance Method Details

#cs_policy(payload) ⇒ Object

object=

    {
        'params': {'action':'bind'},
    "csvserver_cspolicy_binding":
    {
        "name":"cs_test_80",
    "targetvserver":"lb_thumby_80",
    "policyname": "cs_test_rule",
    "priority": "800",

}
}

Raises:

  • (ArgumentError)


25
26
27
28
29
30
# File 'lib/netscaler/cs/vserver/bind.rb', line 25

def cs_policy(payload)
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name, :targetvserver])
  # Need to find a way to throw optional args as well, including :policyname and :priority
  return @netscaler.adapter.post_no_body("config/csvserver_cspolicy_binding/#{payload['name']}", {'params' => {'action' => 'bind'}, 'csvserver_cspolicy_binding' => payload})
end

#lbvserver(payload) ⇒ Object

Raises:

  • (ArgumentError)


44
45
46
47
48
# File 'lib/netscaler/cs/vserver/bind.rb', line 44

def lbvserver(payload)
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name, :lbvserver])
  return @netscaler.adapter.post_no_body("config/csvserver_lbvserver_binding/#{payload['name']}", {'params' => {'action' => 'bind'}, 'csvserver_lbvserver_binding' => payload})
end

#responder_policy(payload) ⇒ Object

Raises:

  • (ArgumentError)


38
39
40
41
42
# File 'lib/netscaler/cs/vserver/bind.rb', line 38

def responder_policy(payload)
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name, :policyName, :priority])
  return @netscaler.adapter.post_no_body("config/csvserver_responderpolicy_binding/#{payload['name']}", {'params' => {'action' => 'bind'}, 'csvserver_responderpolicy_binding' => payload})
end

#rewrite_policy(payload) ⇒ Object

Raises:

  • (ArgumentError)


32
33
34
35
36
# File 'lib/netscaler/cs/vserver/bind.rb', line 32

def rewrite_policy(payload)
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name, :policyName, :priority, :bindpoint])
  return @netscaler.adapter.post_no_body("config/csvserver_rewritepolicy_binding/#{payload['name']}", {'params' => {'action' => 'bind'}, 'csvserver_rewritepolicy_binding' => payload})
end