Class: Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings
- Inherits:
-
Object
- Object
- Datadog::Core::Configuration::AgentSettingsResolver::AgentSettings
- Defined in:
- lib/datadog/core/configuration/agent_settings_resolver.rb
Overview
Immutable container for the resulting settings
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#ssl ⇒ Object
readonly
Returns the value of attribute ssl.
-
#timeout_seconds ⇒ Object
readonly
Returns the value of attribute timeout_seconds.
-
#uds_path ⇒ Object
readonly
Returns the value of attribute uds_path.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(adapter: nil, ssl: nil, hostname: nil, port: nil, uds_path: nil, timeout_seconds: nil) ⇒ AgentSettings
constructor
A new instance of AgentSettings.
- #url ⇒ Object
Constructor Details
#initialize(adapter: nil, ssl: nil, hostname: nil, port: nil, uds_path: nil, timeout_seconds: nil) ⇒ AgentSettings
Returns a new instance of AgentSettings.
26 27 28 29 30 31 32 33 34 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 26 def initialize(adapter: nil, ssl: nil, hostname: nil, port: nil, uds_path: nil, timeout_seconds: nil) @adapter = adapter @ssl = ssl @hostname = hostname @port = port @uds_path = uds_path @timeout_seconds = timeout_seconds freeze end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
24 25 26 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 24 def adapter @adapter end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
24 25 26 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 24 def hostname @hostname end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
24 25 26 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 24 def port @port end |
#ssl ⇒ Object (readonly)
Returns the value of attribute ssl.
24 25 26 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 24 def ssl @ssl end |
#timeout_seconds ⇒ Object (readonly)
Returns the value of attribute timeout_seconds.
24 25 26 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 24 def timeout_seconds @timeout_seconds end |
#uds_path ⇒ Object (readonly)
Returns the value of attribute uds_path.
24 25 26 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 24 def uds_path @uds_path end |
Instance Method Details
#==(other) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 49 def ==(other) self.class == other.class && adapter == other.adapter && ssl == other.ssl && hostname == other.hostname && port == other.port && uds_path == other.uds_path && timeout_seconds == other.timeout_seconds end |
#url ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/datadog/core/configuration/agent_settings_resolver.rb', line 36 def url case adapter when Datadog::Core::Configuration::Ext::Agent::HTTP::ADAPTER hostname = self.hostname hostname = "[#{hostname}]" if hostname =~ IPV6_REGEXP "#{ssl ? 'https' : 'http'}://#{hostname}:#{port}/" when Datadog::Core::Configuration::Ext::Agent::UnixSocket::ADAPTER "unix://#{uds_path}" else raise ArgumentError, "Unexpected adapter: #{adapter}" end end |