Class: KafkaCli::ServiceConf
- Inherits:
-
Object
- Object
- KafkaCli::ServiceConf
- Defined in:
- lib/kafka_cli/service_conf.rb
Constant Summary collapse
- DEFAULT_CLIENT_ID =
'kafkacli'- DEFAULT_BROKER =
'localhost:9092'- ATTRIBUTES =
ServiceConfElement.new( label: :client_id, keys: [:'client-id'], default_value: DEFAULT_CLIENT_ID, desc: 'Kafka client id' ), ServiceConfElement.new( label: :brokers, keys: %i[brokers b], default_value: DEFAULT_BROKER, desc: 'Boostrap servers' ), ServiceConfElement.new( label: :ssl_certificate, keys: %i[certificate cert], desc: 'SSL certificate for AUTH (PEM)' ), ServiceConfElement.new( label: :ssl_key, keys: [:key], desc: 'SSL private key for AUTH (PEM)' ), ServiceConfElement.new( label: :ssl_key_password, keys: [:'key-password'], desc: 'SSL private key password (if encrypted)' ), ServiceConfElement.new( label: :ssl_ca, keys: [:'ca-cert'], desc: 'SSL CA certificate (PEM)' ), ServiceConfElement.new( label: :ssl_verify, keys: [:'ssl-verify'], default_value: true, desc: 'SSL hostname verification' ), ServiceConfElement.new( label: :socket_timeout, keys: [:'socket-timeout'], default_value: 30_000, desc: 'Socket Timeout' ), ServiceConfElement.new( label: :request_timeout, desc: 'Request Timeout', keys: [:'request-timeout'], default_value: 30_000 ) ].to_h { |attribute| [attribute.label, attribute] }
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #brokers_auth_mode ⇒ Object
-
#initialize(**options) ⇒ ServiceConf
constructor
A new instance of ServiceConf.
- #method_missing(method_name, *args, **kwargs) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(**options) ⇒ ServiceConf
Returns a new instance of ServiceConf.
65 66 67 |
# File 'lib/kafka_cli/service_conf.rb', line 65 def initialize(**) @options = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **kwargs) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/kafka_cli/service_conf.rb', line 69 def method_missing(method_name, *args, **kwargs, &) return super unless ATTRIBUTES.key?(method_name.to_sym) = ATTRIBUTES[method_name.to_sym].keys.first .fetch(, nil) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/kafka_cli/service_conf.rb', line 7 def @options end |
Instance Method Details
#brokers_auth_mode ⇒ Object
80 81 82 |
# File 'lib/kafka_cli/service_conf.rb', line 80 def brokers_auth_mode 'ssl' if ssl_certificate end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
76 77 78 |
# File 'lib/kafka_cli/service_conf.rb', line 76 def respond_to_missing?(method_name, include_private = false) ATTRIBUTES.key?(method_name.to_sym) || super end |