Sha256: f43de1e3384b7e03a96b71b673468cd894b0b69d60d7ba6d50e4e32828481808

Contents?: true

Size: 1.29 KB

Versions: 49

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

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

        def initialize(name:, type:, error_code:, error_message:)
          @name = name
          @type = type
          @error_code = error_code
          @error_message = error_message
        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

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

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

  end
end

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
ruby-kafka-0.7.6.beta2 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.6.beta1 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.5 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.5.beta1 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.4 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.3 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.2 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.1.debugcorruption2 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.1.messagecorruptiondebug lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.1 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.1.beta2 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.1.possible.pre.fetch.pre.fix lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.1.beta1 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.0 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.6.8 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.0.beta2 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.0.beta1 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.7.0.alpha4 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.6.7 lib/kafka/protocol/alter_configs_response.rb
ruby-kafka-0.6.6 lib/kafka/protocol/alter_configs_response.rb