Class: Netscaler::Policy::Stringmap

Inherits:
NetscalerService show all
Defined in:
lib/netscaler/policy/stringmap.rb

Instance Method Summary collapse

Methods inherited from NetscalerService

#validate_payload

Constructor Details

#initialize(netscaler) ⇒ Stringmap

Returns a new instance of Stringmap.



6
7
8
# File 'lib/netscaler/policy/stringmap.rb', line 6

def initialize(netscaler)
  @netscaler = netscaler
end

Instance Method Details

#add(payload) ⇒ Object

:args: :name => ‘foo’

Raises:

  • (ArgumentError)


19
20
21
22
23
# File 'lib/netscaler/policy/stringmap.rb', line 19

def add(payload)  # :args: :name => 'foo'
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name])
  return @netscaler.adapter.post_no_body('config/policystringmap/', 'policystringmap' => payload)
end

#bind(payload) ⇒ Object

:args: :name => ‘foo’, :key => ‘a’, :value => ‘1’

Raises:

  • (ArgumentError)


31
32
33
34
35
# File 'lib/netscaler/policy/stringmap.rb', line 31

def bind(payload)   # :args: :name => 'foo', :key => 'a', :value => '1'
  raise ArgumentError, 'payload cannot be null' if payload.nil?
  validate_payload(payload, [:name, :key, :value])
  return @netscaler.adapter.post_no_body('config/policystringmap_pattern_binding/', 'policystringmap_pattern_binding' => payload)
end

#get(payload) ⇒ Object

:args: :name => ‘foo’

Raises:

  • (ArgumentError)


25
26
27
28
29
# File 'lib/netscaler/policy/stringmap.rb', line 25

def get(payload)  # :args: :name => 'foo'
  raise ArgumentError, 'arg must contain name of policystringmap! :name => "foo"' if payload.nil?
  validate_payload(payload, [:name])
  return @netscaler.adapter.get("config/policystringmap_pattern_binding/#{payload[:name]}")
end

#list(payload = nil) ⇒ Object

:args: :name => ‘foo’



10
11
12
13
14
15
16
17
# File 'lib/netscaler/policy/stringmap.rb', line 10

def list(payload = nil) # :args: :name => 'foo'
  if payload !=nil then
    validate_payload(payload, [:name])
    return @netscaler.adapter.get("config/policystringmap/#{payload[:name]}")
  else
    return @netscaler.adapter.get("config/policystringmap/")
  end
end