<commit_before>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?
        payload = Netscaler.hash_hack(payload)
        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?
        payload = Netscaler.hash_hack(payload)
        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?
        payload = Netscaler.hash_hack(payload)
        validate_payload(payload, [:name, :serviceType, :ipv46, :port])
        return @netscaler.adapter.post_no_body('config/lbvserver/', {'lbvserver' => payload})
      end

      def bind
        Bind.new @netscaler
      end

      def unbind
        Unbind.new @netscaler
      end

    end
  end
end<commit_msg>added stat method to lbvserver<commit_after>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?
        payload = Netscaler.hash_hack(payload)
        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?
        payload = Netscaler.hash_hack(payload)
        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?
        payload = Netscaler.hash_hack(payload)
        validate_payload(payload, [:name, :serviceType, :ipv46, :port])
        return @netscaler.adapter.post_no_body('config/lbvserver/', {'lbvserver' => payload})
      end

      def stat(payload)
        raise ArgumentError, 'payload cannot be null' if payload.nil?
        payload = Netscaler.hash_hack(payload)
        validate_payload(payload, [:name])
        return @netscaler.adapter.get("stat/lbvserver/#{payload[:name]}")
      end

      def bind
        Bind.new @netscaler
      end

      def unbind
        Unbind.new @netscaler
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.10526315789473684, 'fraction_numerical': 0.0011318619128466328, 'mean_word_length': 2.6746361746361744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1654344', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1032, 'n_words': 249}