class Kongfigure::Resources::Upstream
Attributes
hash_fallback[RW]
hash_fallback_header[RW]
hash_on[RW]
hash_on_header[RW]
healthchecks[RW]
name[RW]
slots[RW]
targets[RW]
Public Class Methods
build(hash)
click to toggle source
# File lib/kongfigure/resources/upstream.rb, line 6 def self.build(hash) upstream = new(hash["id"], hash["kongfigure_ignore_fields"]) upstream.name = hash["name"] upstream.hash_on = hash["hash_on"] upstream.hash_fallback = hash["hash_fallback"] upstream.hash_on_cookie_path = hash["hash_on_cookie_path"] upstream.slots = hash["slots"] upstream.healthchecks = hash["healthchecks"] upstream.hash_on_header = hash["hash_on_header"] upstream.hash_fallback = hash["hash_fallback"] upstream.hash_fallback_header = hash["hash_fallback_header"] upstream.hash_on_cookie = hash["hash_on_cookie"] upstream.targets = Kongfigure::Resources::Target.build_all(hash["targets"] || []) upstream end
Public Instance Methods
api_attributes()
click to toggle source
# File lib/kongfigure/resources/upstream.rb, line 38 def api_attributes { "name" => name, "hash_on" => hash_on, "hash_fallback" => hash_fallback, "hash_on_cookie_path" => hash_on_cookie_path, "slots" => healthchecks, "hash_on_header" => hash_on_header, "hash_fallback_header" => hash_fallback_header, "hash_on_cookie" => hash_on_cookie }.compact end
api_name()
click to toggle source
# File lib/kongfigure/resources/upstream.rb, line 34 def api_name "upstreams" end
has_target?(target)
click to toggle source
# File lib/kongfigure/resources/upstream.rb, line 51 def has_target?(target) targets && targets.include?(target) end
identifier()
click to toggle source
# File lib/kongfigure/resources/upstream.rb, line 22 def identifier name end
to_s()
click to toggle source
# File lib/kongfigure/resources/upstream.rb, line 26 def to_s if targets.size > 0 "#{name} with targets #{targets.map(&:target).join(', ')}" else "#{name} without target" end end