Sha256: a3e008d31f903d4642655f87a7d4477ce28919a7cf1524443444a5f4386a9d49

Contents?: true

Size: 1.98 KB

Versions: 8

Compression:

Stored size: 1.98 KB

Contents

module Kafka
  module Protocol
    class DescribeConfigsResponse
      class ResourceDescription
        attr_reader :name, :type, :error_code, :error_message, :configs

        def initialize(name:, type:, error_code:, error_message:, configs:)
          @name = name
          @type = type
          @error_code = error_code
          @error_message = error_message
          @configs = configs
        end
      end

      class ConfigEntry
        attr_reader :name, :value, :read_only, :is_default, :is_sensitive

        def initialize(name:, value:, read_only:, is_default:, is_sensitive:)
          @name = name
          @value = value
          @read_only = read_only
          @is_default = is_default
          @is_sensitive = is_sensitive
        end
      end

      attr_reader :resources

      def initialize(throttle_time_ms:, resources:)
        @throttle_time_ms = throttle_time_ms
        @resources = resources
      end

      def self.decode(decoder)
        throttle_time_ms = decoder.int32
        resources = decoder.array do
          error_code = decoder.int16
          error_message = decoder.string

          resource_type = decoder.int8
          if Kafka::Protocol::RESOURCE_TYPES[resource_type].nil?
            raise Kafka::ProtocolError, "Resource type not supported: #{resource_type}"
          end
          resource_name = decoder.string

          configs = decoder.array do
            ConfigEntry.new(
              name: decoder.string,
              value: decoder.string,
              read_only: decoder.boolean,
              is_default: decoder.boolean,
              is_sensitive: decoder.boolean,
            )
          end

          ResourceDescription.new(
            type: RESOURCE_TYPES[resource_type],
            name: resource_name,
            error_code: error_code,
            error_message: error_message,
            configs: configs
          )
        end

        new(throttle_time_ms: throttle_time_ms, resources: resources)
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby-kafka-0.6.0.beta4 lib/kafka/protocol/describe_configs_response.rb
ruby-kafka-0.6.0.beta3 lib/kafka/protocol/describe_configs_response.rb
ruby-kafka-0.6.0.beta2 lib/kafka/protocol/describe_configs_response.rb
ruby-kafka-0.6.0.beta1 lib/kafka/protocol/describe_configs_response.rb
ruby-kafka-0.5.5 lib/kafka/protocol/describe_configs_response.rb
ruby-kafka-0.5.4 lib/kafka/protocol/describe_configs_response.rb
ruby-kafka-0.5.4.beta1 lib/kafka/protocol/describe_configs_response.rb
ruby-kafka-0.5.3 lib/kafka/protocol/describe_configs_response.rb