Class: Kongfigure::Resources::Route
- Defined in:
- lib/kongfigure/resources/route.rb
Instance Attribute Summary collapse
-
#destinations ⇒ Object
Returns the value of attribute destinations.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#hosts ⇒ Object
Returns the value of attribute hosts.
-
#methods ⇒ Object
Returns the value of attribute methods.
-
#name ⇒ Object
Returns the value of attribute name.
-
#paths ⇒ Object
Returns the value of attribute paths.
-
#preserve_host ⇒ Object
Returns the value of attribute preserve_host.
-
#protocols ⇒ Object
Returns the value of attribute protocols.
-
#regex_priority ⇒ Object
Returns the value of attribute regex_priority.
-
#service ⇒ Object
Returns the value of attribute service.
-
#snis ⇒ Object
Returns the value of attribute snis.
-
#sources ⇒ Object
Returns the value of attribute sources.
-
#strip_path ⇒ Object
Returns the value of attribute strip_path.
Attributes inherited from Base
#id, #kongfigure_ignore_fields, #plugins, #unchanged, #updated
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#==, build_all, #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
#destinations ⇒ Object
Returns the value of attribute destinations.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def destinations @destinations end |
#headers ⇒ Object
Returns the value of attribute headers.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def headers @headers end |
#hosts ⇒ Object
Returns the value of attribute hosts.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def hosts @hosts end |
#methods ⇒ Object
Returns the value of attribute methods.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def methods @methods end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def name @name end |
#paths ⇒ Object
Returns the value of attribute paths.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def paths @paths end |
#preserve_host ⇒ Object
Returns the value of attribute preserve_host.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def preserve_host @preserve_host end |
#protocols ⇒ Object
Returns the value of attribute protocols.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def protocols @protocols end |
#regex_priority ⇒ Object
Returns the value of attribute regex_priority.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def regex_priority @regex_priority end |
#service ⇒ Object
Returns the value of attribute service.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def service @service end |
#snis ⇒ Object
Returns the value of attribute snis.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def snis @snis end |
#sources ⇒ Object
Returns the value of attribute sources.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def sources @sources end |
#strip_path ⇒ Object
Returns the value of attribute strip_path.
3 4 5 |
# File 'lib/kongfigure/resources/route.rb', line 3 def strip_path @strip_path end |
Class Method Details
.build(hash) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kongfigure/resources/route.rb', line 6 def self.build(hash) raise "Route ID is missing for #{hash.inspect}" if hash["id"].nil? route = new(hash["id"], hash["kongfigure_ignore_fields"]) route.name = hash["name"] route.protocols = hash["protocols"] route.methods = hash["methods"] route.paths = hash["paths"] route.regex_priority = hash["regex_priority"] route.strip_path = hash["strip_path"] route.preserve_host = hash["snis"] route.sources = hash["destinations"] route.service = hash["service"] route.hosts = hash["hosts"] route.headers = hash["headers"] route.plugins = Kongfigure::Resources::Plugin.build_all(hash["plugins"] || []) route end |
Instance Method Details
#api_attributes ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/kongfigure/resources/route.rb', line 40 def api_attributes { "id" => id, "name" => name, "protocols" => protocols, "methods" => methods, "paths" => paths, "hosts" => hosts, "headers" => headers, "regex_priority" => regex_priority, "strip_path" => strip_path, "preserve_host" => preserve_host, "sources" => sources, "service" => service }.compact end |
#api_name ⇒ Object
28 29 30 |
# File 'lib/kongfigure/resources/route.rb', line 28 def api_name "routes" end |
#display_name ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/kongfigure/resources/route.rb', line 32 def display_name if name.nil? "default route" else "route (name: #{name})" end end |
#identifier ⇒ Object
24 25 26 |
# File 'lib/kongfigure/resources/route.rb', line 24 def identifier id end |