class Dalli::Elasticache::AutoDiscovery::ConfigResponse
This class wraps the raw ASCII response from an Auto Discovery endpoint and provides methods for extracting data from that response.
docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/AutoDiscovery.AddingToYourClientLibrary.html
Constants
- NODE_LIST_REGEX
- NODE_REGEX
Matches strings like “my-cluster.001.cache.aws.com|10.154.182.29|11211”
- VERSION_REGEX
Matches the version line of the response
Attributes
text[R]
The raw response text
Public Class Methods
new(response_text)
click to toggle source
# File lib/dalli/elasticache/auto_discovery/config_response.rb, line 21 def initialize(response_text) @text = response_text.to_s end
Public Instance Methods
nodes()
click to toggle source
Node
hosts, ip addresses, and ports
Returns an Array of Hashes with values for :host, :ip and :port
# File lib/dalli/elasticache/auto_discovery/config_response.rb, line 38 def nodes NODE_LIST_REGEX.match(@text).to_s.scan(NODE_REGEX).map do |match| Node.new(match[1], match[2], match[3].to_i) end end
version()
click to toggle source
The number of times the configuration has been changed
Returns an integer
# File lib/dalli/elasticache/auto_discovery/config_response.rb, line 28 def version m = VERSION_REGEX.match(@text) return -1 unless m m[1].to_i end