Class: Kafka::Protocol::SaslHandshakeRequest

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

Overview

SaslHandshake Request (Version: 0) => mechanism mechanism => string

Constant Summary collapse

SUPPORTED_MECHANISMS =
%w(GSSAPI PLAIN SCRAM-SHA-256 SCRAM-SHA-512 OAUTHBEARER)

Instance Method Summary collapse

Constructor Details

#initialize(mechanism) ⇒ SaslHandshakeRequest

Returns a new instance of SaslHandshakeRequest


13
14
15
16
17
18
# File 'lib/kafka/protocol/sasl_handshake_request.rb', line 13

def initialize(mechanism)
  unless SUPPORTED_MECHANISMS.include?(mechanism)
    raise Kafka::Error, "Unsupported SASL mechanism #{mechanism}. Supported are #{SUPPORTED_MECHANISMS.join(', ')}"
  end
  @mechanism = mechanism
end

Instance Method Details

#api_keyObject


20
21
22
# File 'lib/kafka/protocol/sasl_handshake_request.rb', line 20

def api_key
  SASL_HANDSHAKE_API
end

#encode(encoder) ⇒ Object


28
29
30
# File 'lib/kafka/protocol/sasl_handshake_request.rb', line 28

def encode(encoder)
  encoder.write_string(@mechanism)
end

#response_classObject


24
25
26
# File 'lib/kafka/protocol/sasl_handshake_request.rb', line 24

def response_class
  SaslHandshakeResponse
end