class Kongfigure::Resources::Route

Attributes

destinations[RW]
hosts[RW]
methods[RW]
name[RW]
paths[RW]
preserve_host[RW]
protocols[RW]
regex_priority[RW]
service[RW]
snis[RW]
sources[RW]
strip_path[RW]

Public Class Methods

build(hash) click to toggle source
# 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.plugins        = Kongfigure::Resources::Plugin.build_all(hash["plugins"] || [])
  route
end

Public Instance Methods

api_attributes() click to toggle source
# File lib/kongfigure/resources/route.rb, line 39
def api_attributes
  {
    "id"             => id,
    "name"           => name,
    "protocols"      => protocols,
    "methods"        => methods,
    "paths"          => paths,
    "hosts"          => hosts,
    "regex_priority" => regex_priority,
    "strip_path"     => strip_path,
    "preserve_host"  => preserve_host,
    "sources"        => sources,
    "service"        => service
  }.compact
end
api_name() click to toggle source
# File lib/kongfigure/resources/route.rb, line 27
def api_name
  "routes"
end
display_name() click to toggle source
# File lib/kongfigure/resources/route.rb, line 31
def display_name
  if name.nil?
    "default route"
  else
    "route (name: #{name})"
  end
end
identifier() click to toggle source
# File lib/kongfigure/resources/route.rb, line 23
def identifier
  id
end