Sha256: e55ac246e22701f4dd62d302df263a761153999e85c9e3a0b52485e87f4df7cb

Contents?: true

Size: 1.8 KB

Versions: 7

Compression:

Stored size: 1.8 KB

Contents

require 'netscaler/netscaler_service'

module Netscaler
  class Lb
    class Vserver < NetscalerService
      def initialize(netscaler)
        @netscaler=netscaler
      end

      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

      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

      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

      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

      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 cannot be null' if payload.nil?
        end
      end

      def bind
        Bind.new @netscaler
      end

      def unbind
        Unbind.new @netscaler
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
netscaler-0.8.2 lib/netscaler/lb/vserver.rb
netscaler-0.8.1 lib/netscaler/lb/vserver.rb
netscaler-0.8.0 lib/netscaler/lb/vserver.rb
netscaler-0.7.1 lib/netscaler/lb/vserver.rb
netscaler-0.6.0 lib/netscaler/lb/vserver.rb
netscaler-0.5.2 lib/netscaler/lb/vserver.rb
netscaler-0.5.1 lib/netscaler/lb/vserver.rb