Class: Kafka::Protocol::AlterConfigsRequest

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

Instance Method Summary collapse

Constructor Details

#initialize(resources:) ⇒ AlterConfigsRequest

Returns a new instance of AlterConfigsRequest.



7
8
9
# File 'lib/kafka/protocol/alter_configs_request.rb', line 7

def initialize(resources:)
  @resources = resources
end

Instance Method Details

#api_keyObject



11
12
13
# File 'lib/kafka/protocol/alter_configs_request.rb', line 11

def api_key
  ALTER_CONFIGS_API
end

#api_versionObject



15
16
17
# File 'lib/kafka/protocol/alter_configs_request.rb', line 15

def api_version
  0
end

#encode(encoder) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/kafka/protocol/alter_configs_request.rb', line 23

def encode(encoder)
  encoder.write_array(@resources) do |type, name, configs|
    encoder.write_int8(type)
    encoder.write_string(name)

    configs = configs.to_a
    encoder.write_array(configs) do |config_name, config_value|
      # Config value is nullable. In other cases, we must write the
      # stringified value.
      config_value = config_value.to_s unless config_value.nil?

      encoder.write_string(config_name)
      encoder.write_string(config_value)
    end
  end
  # validate_only. We'll skip this feature.
  encoder.write_boolean(false)
end

#response_classObject



19
20
21
# File 'lib/kafka/protocol/alter_configs_request.rb', line 19

def response_class
  Protocol::AlterConfigsResponse
end