Class: Netscaler::Server
- Inherits:
-
NetscalerService
- Object
- NetscalerService
- Netscaler::Server
- Defined in:
- lib/netscaler/server.rb
Instance Method Summary collapse
-
#add(server) ⇒ Object
method #add requires arg :name but :ipaddress and :domain are optional but requires one of them.
-
#disable(payload) ⇒ Object
:args: :server, :service_group.
-
#enable(payload) ⇒ Object
:args: :server, :service_group.
-
#initialize(netscaler) ⇒ Server
constructor
A new instance of Server.
-
#remove(payload) ⇒ Object
:args: :server.
-
#show(payload = {}) ⇒ Object
:server is optional, if omitted it will return all servers configured on the Netscaler.
-
#show_bindings(payload) ⇒ Object
:args: :server => ‘foo’.
Methods inherited from NetscalerService
Constructor Details
#initialize(netscaler) ⇒ Server
Returns a new instance of Server.
5 6 7 |
# File 'lib/netscaler/server.rb', line 5 def initialize(netscaler) @netscaler = netscaler end |
Instance Method Details
#add(server) ⇒ Object
method #add requires arg :name but :ipaddress and :domain are optional but requires one of them.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/netscaler/server.rb', line 11 def add(server) # :args: :name => 'foo', :ipaddress => '192.168.1.10', :domain => 'bar.com' raise ArgumentError, 'server cannot be null' if server.nil? if server[:domain] != nil then validate_payload(server, [:name, :domain]) else validate_payload(server, [:name, :ipaddress]) end return @netscaler.adapter.post_no_body('config/server/', {'server' => server}) end |
#disable(payload) ⇒ Object
:args: :server, :service_group
32 33 34 |
# File 'lib/netscaler/server.rb', line 32 def disable(payload) # :args: :server, :service_group toggle('disable', payload) end |
#enable(payload) ⇒ Object
:args: :server, :service_group
28 29 30 |
# File 'lib/netscaler/server.rb', line 28 def enable(payload) # :args: :server, :service_group toggle('enable', payload) end |
#remove(payload) ⇒ Object
:args: :server
22 23 24 25 26 |
# File 'lib/netscaler/server.rb', line 22 def remove(payload) # :args: :server raise ArgumentError, 'payload cannot be null' if payload.nil? validate_payload(payload, [:server]) return @netscaler.adapter.delete("config/server/#{payload[:server]}") end |
#show(payload = {}) ⇒ Object
:server is optional, if omitted it will return all servers configured on the Netscaler.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/netscaler/server.rb', line 45 def show(payload = {}) # :args: :server => 'foo' if payload[:server] != nil then validate_payload(payload, [:server]) return @netscaler.adapter.get("config/server/#{payload[:server]}") elsif payload == {} then return @netscaler.adapter.get('config/server/') else raise ArgumentError, 'payload supplied must have been missing :server' end end |
#show_bindings(payload) ⇒ Object
:args: :server => ‘foo’
36 37 38 39 40 |
# File 'lib/netscaler/server.rb', line 36 def show_bindings(payload) # :args: :server => 'foo' raise ArgumentError, 'payload cannot be null' if payload.nil? validate_payload(payload, [:server]) return @netscaler.adapter.get("config/server_binding/#{payload[:server]}") end |