class Cfnlego::Resource

Attributes

name[R]
type[R]

Public Class Methods

new(type, name) click to toggle source
# File lib/cfnlego/resource.rb, line 7
def initialize(type, name)
  @type = type
  @name = name 
end

Public Instance Methods

attributes() click to toggle source
# File lib/cfnlego/resource.rb, line 12
def attributes
  definition["#{@type}"]["Attributes"]
end
properties() click to toggle source
# File lib/cfnlego/resource.rb, line 16
def properties
  definition["#{@type}"]['Properties']
end

Private Instance Methods

definition() click to toggle source
# File lib/cfnlego/resource.rb, line 27
def definition
  if File::exists?(type2file)
    @definition ||= YAML.load_file(type2file)
  else
    raise RuntimeError, "unknown #{@type}, no matching definition found"
  end
end
type2file() click to toggle source

example AWS::AutoScaling::AutoScalingGroup

# File lib/cfnlego/resource.rb, line 23
def type2file
  @file ||= "#{File.realpath(File.dirname(__FILE__))}/resources/#{@type.gsub(/::/, File::SEPARATOR)}.yaml"
end