Class: ClowderCommonRuby::BrokerConfig

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/clowder-common-ruby/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ BrokerConfig

Returns a new instance of BrokerConfig.



216
217
218
219
220
221
222
223
224
225
226
# File 'lib/clowder-common-ruby/types.rb', line 216

def initialize(attributes)
  super
  raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))

  attributes = attributes.each_with_object({}) do |(k, v), h|
    warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
    h[k.to_sym] = v
  end

  @sasl = KafkaSASLConfig.new(attributes.fetch(:sasl, {}))
end

Instance Attribute Details

#saslObject

Returns the value of attribute sasl.



214
215
216
# File 'lib/clowder-common-ruby/types.rb', line 214

def sasl
  @sasl
end

Instance Method Details

#valid_keysObject



228
229
230
231
232
233
234
235
236
237
# File 'lib/clowder-common-ruby/types.rb', line 228

def valid_keys
  [].tap do |keys|
    keys << :hostname
    keys << :port
    keys << :cacert
    keys << :authtype
    keys << :sasl
    keys << :securityProtocol
  end
end