class Karafka::Contracts::ConsumerGroup

Contract for single full route (consumer group + topics) validation.

Constants

TOPIC_CONTRACT

Internal contract for sub-validating topics schema

Private Instance Methods

kafka_uri?(value) click to toggle source

@param value [String] potential kafka uri @return [Boolean] true if it is a kafka uri, otherwise false

# File lib/karafka/contracts/consumer_group.rb, line 203
def kafka_uri?(value)
  uri = URI.parse(value)
  URI_SCHEMES.include?(uri.scheme) && uri.port
rescue URI::InvalidURIError
  false
end
valid_certificate?(value) click to toggle source

@param value [String] potential X509 cert value @return [Boolean] is the given string a valid X509 cert

# File lib/karafka/contracts/consumer_group.rb, line 194
def valid_certificate?(value)
  OpenSSL::X509::Certificate.new(value)
  true
rescue OpenSSL::X509::CertificateError
  false
end
valid_private_key?(value) click to toggle source

@param value [String] potential RSA key value @return [Boolean] is the given string a valid RSA key

# File lib/karafka/contracts/consumer_group.rb, line 185
def valid_private_key?(value)
  OpenSSL::PKey.read(value)
  true
rescue OpenSSL::PKey::PKeyError
  false
end