Class: Kafka::Protocol::DescribeConfigsResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/kafka/protocol/describe_configs_response.rb

Defined Under Namespace

Classes: ConfigEntry, ResourceDescription

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(throttle_time_ms:, resources:) ⇒ DescribeConfigsResponse

Returns a new instance of DescribeConfigsResponse.

[View source]

32
33
34
35
# File 'lib/kafka/protocol/describe_configs_response.rb', line 32

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

Instance Attribute Details

#resourcesObject (readonly)

Returns the value of attribute resources.


30
31
32
# File 'lib/kafka/protocol/describe_configs_response.rb', line 30

def resources
  @resources
end

Class Method Details

.decode(decoder) ⇒ Object

[View source]

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/kafka/protocol/describe_configs_response.rb', line 37

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