Class: Fluent::Plugin::SslCheckInput::SslInfo
- Inherits:
-
Object
- Object
- Fluent::Plugin::SslCheckInput::SslInfo
- Defined in:
- lib/fluent/plugin/in_ssl_check.rb
Overview
ssl info
to encapsulate extracted ssl information
Constant Summary collapse
- OK =
1- KO =
0
Instance Attribute Summary collapse
-
#cert ⇒ Object
Returns the value of attribute cert.
-
#cert_chain ⇒ Object
Returns the value of attribute cert_chain.
-
#error ⇒ Object
Returns the value of attribute error.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #error_class ⇒ Object
- #expire_in_days ⇒ Object
-
#initialize(host: nil, port: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: Time.now) ⇒ SslInfo
constructor
rubocop:disable Metrics/ParameterLists.
- #not_after ⇒ Object
- #status ⇒ Object
-
#subject_s ⇒ Object
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(host: nil, port: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: Time.now) ⇒ SslInfo
rubocop:disable Metrics/ParameterLists
194 195 196 197 198 199 200 201 202 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 194 def initialize(host: nil, port: nil, cert: nil, cert_chain: nil, ssl_version: nil, error: nil, time: Time.now) @host = host @port = port @cert = cert @cert_chain = cert_chain @ssl_version = ssl_version @error = error @time = time end |
Instance Attribute Details
#cert ⇒ Object
Returns the value of attribute cert.
191 192 193 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 191 def cert @cert end |
#cert_chain ⇒ Object
Returns the value of attribute cert_chain.
191 192 193 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 191 def cert_chain @cert_chain end |
#error ⇒ Object
Returns the value of attribute error.
191 192 193 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 191 def error @error end |
#host ⇒ Object
Returns the value of attribute host.
191 192 193 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 191 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
191 192 193 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 191 def port @port end |
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
191 192 193 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 191 def ssl_version @ssl_version end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
190 191 192 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 190 def time @time end |
Instance Method Details
#error_class ⇒ Object
228 229 230 231 232 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 228 def error_class return unless error error.class.to_s end |
#expire_in_days ⇒ Object
209 210 211 212 213 214 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 209 def expire_in_days return unless cert&.not_after expire_in = cert.not_after ((expire_in - time) / 3600 / 24).to_i end |
#not_after ⇒ Object
216 217 218 219 220 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 216 def not_after return unless cert cert.not_after.iso8601(3) end |
#status ⇒ Object
222 223 224 225 226 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 222 def status return KO if error OK end |
#subject_s ⇒ Object
rubocop:enable Metrics/ParameterLists
205 206 207 |
# File 'lib/fluent/plugin/in_ssl_check.rb', line 205 def subject_s cert.subject.to_s if cert&.subject end |