Class: Kongfigure::Resources::Upstream
- Defined in:
- lib/kongfigure/resources/upstream.rb
Instance Attribute Summary collapse
-
#hash_fallback ⇒ Object
Returns the value of attribute hash_fallback.
-
#hash_fallback_header ⇒ Object
Returns the value of attribute hash_fallback_header.
-
#hash_on ⇒ Object
Returns the value of attribute hash_on.
-
#hash_on_cookie ⇒ Object
Returns the value of attribute hash_on_cookie.
-
#hash_on_cookie_path ⇒ Object
Returns the value of attribute hash_on_cookie_path.
-
#hash_on_header ⇒ Object
Returns the value of attribute hash_on_header.
-
#healthchecks ⇒ Object
Returns the value of attribute healthchecks.
-
#name ⇒ Object
Returns the value of attribute name.
-
#slots ⇒ Object
Returns the value of attribute slots.
-
#targets ⇒ Object
Returns the value of attribute targets.
Attributes inherited from Base
#id, #kongfigure_ignore_fields, #plugins, #unchanged, #updated
Class Method Summary collapse
Instance Method Summary collapse
- #api_attributes ⇒ Object
- #api_name ⇒ Object
- #has_target?(target) ⇒ Boolean
- #identifier ⇒ Object
- #to_s ⇒ Object
Methods inherited from Base
#==, build_all, #display_name, #has_to_be_deleted?, #initialize, #mark_as_unchanged, #mark_as_updated, #plugin_allowed?
Constructor Details
This class inherits a constructor from Kongfigure::Resources::Base
Instance Attribute Details
#hash_fallback ⇒ Object
Returns the value of attribute hash_fallback.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def hash_fallback @hash_fallback end |
#hash_fallback_header ⇒ Object
Returns the value of attribute hash_fallback_header.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def hash_fallback_header @hash_fallback_header end |
#hash_on ⇒ Object
Returns the value of attribute hash_on.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def hash_on @hash_on end |
#hash_on_cookie ⇒ Object
Returns the value of attribute hash_on_cookie.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def @hash_on_cookie end |
#hash_on_cookie_path ⇒ Object
Returns the value of attribute hash_on_cookie_path.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def @hash_on_cookie_path end |
#hash_on_header ⇒ Object
Returns the value of attribute hash_on_header.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def hash_on_header @hash_on_header end |
#healthchecks ⇒ Object
Returns the value of attribute healthchecks.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def healthchecks @healthchecks end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def name @name end |
#slots ⇒ Object
Returns the value of attribute slots.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def slots @slots end |
#targets ⇒ Object
Returns the value of attribute targets.
3 4 5 |
# File 'lib/kongfigure/resources/upstream.rb', line 3 def targets @targets end |
Class Method Details
.build(hash) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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["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["hash_on_cookie"] upstream.targets = Kongfigure::Resources::Target.build_all(hash["targets"] || []) upstream end |
Instance Method Details
#api_attributes ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# 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" => , "slots" => healthchecks, "hash_on_header" => hash_on_header, "hash_fallback_header" => hash_fallback_header, "hash_on_cookie" => }.compact end |
#api_name ⇒ Object
34 35 36 |
# File 'lib/kongfigure/resources/upstream.rb', line 34 def api_name "upstreams" end |
#has_target?(target) ⇒ Boolean
51 52 53 |
# File 'lib/kongfigure/resources/upstream.rb', line 51 def has_target?(target) targets && targets.include?(target) end |
#identifier ⇒ Object
22 23 24 |
# File 'lib/kongfigure/resources/upstream.rb', line 22 def identifier name end |
#to_s ⇒ Object
26 27 28 29 30 31 32 |
# 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 |