class Bosh::Director::DeploymentPlan::TemplateLink
Public Class Methods
parse(kind, link_def)
click to toggle source
# File lib/bosh/director/deployment_plan/links/template_link.rb, line 4 def self.parse(kind, link_def) if kind == "consumes" return self.parse_consumes_link(link_def) elsif kind == "provides" return self.parse_provides_link(link_def) end end
parse_consumes_link(link_def)
click to toggle source
# File lib/bosh/director/deployment_plan/links/template_link.rb, line 12 def self.parse_consumes_link(link_def) if link_def.is_a?(Hash) && link_def.has_key?('type') && link_def.has_key?('name') if link_def.has_key?('from') return new(link_def['from'].split(".")[-1], link_def['type'], link_def['optional'] || false) else return new(link_def['name'], link_def['type'], link_def['optional'] || false) end end raise JobInvalidLinkSpec, "Link '#{link_def}' must be a hash with name and type" end
parse_provides_link(link_def)
click to toggle source
# File lib/bosh/director/deployment_plan/links/template_link.rb, line 23 def self.parse_provides_link(link_def) if link_def.is_a?(Hash) && link_def.has_key?('type') && link_def.has_key?('name') if link_def.has_key?('optional') raise JobInvalidLinkSpec, "Link '#{link_def['name']}' of type '#{link_def['type']}' is a provides link, not allowed to have 'optional' key" elsif link_def.has_key?('as') return new(link_def['as'], link_def['type'], false, link_def['shared'] || false) else return new(link_def['name'], link_def['type'], false, link_def['shared'] || false) end end raise JobInvalidLinkSpec, "Link '#{link_def}' must be a hash with name and type" end
Public Instance Methods
to_s()
click to toggle source
# File lib/bosh/director/deployment_plan/links/template_link.rb, line 36 def to_s "name: #{name}, type: #{type}, shared: #{shared || false}" end