Sha256: 5173048bba553a5804fd3b362cfb32832dc21d1fb9b088fe7e6e5f3bfd7cd519

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

class Jets::Resource
  extend Memoist

  autoload :Base, 'jets/resource/base'
  autoload :Replacer, 'jets/resource/replacer'
  autoload :Permission, 'jets/resource/permission'
  autoload :ApiGateway, 'jets/resource/api_gateway'
  autoload :ChildStack, 'jets/resource/child_stack'
  autoload :Function, 'jets/resource/function'
  autoload :Iam, 'jets/resource/iam'
  autoload :S3, 'jets/resource/s3'

  attr_reader :definition, :replacements
  def initialize(definition, replacements={})
    @definition = definition
    @replacements = replacements
  end

  def logical_id
    id = definition.keys.first
    # replace possible {namespace} in the logical id
    id = replacer.replace_value(id)
    Jets::Camelizer.camelize(id)
  end

  def type
    attributes['Type']
  end

  def properties
    attributes['Properties']
  end

  def attributes
    attributes = definition.values.first
    attributes = replacer.replace_placeholders(attributes)
    Jets::Camelizer.transform(attributes)
  end

  def parameters
    {}
  end

  def outputs
    {}
  end

  def replacer
    Replacer.new(replacements)
  end
  memoize :replacer

  def permission
    Permission.new(replacements, self)
  end
  memoize :permission
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jets-0.8.18 lib/jets/resource.rb
jets-0.8.17 lib/jets/resource.rb
jets-0.8.15 lib/jets/resource.rb
jets-0.8.14 lib/jets/resource.rb
jets-0.8.13 lib/jets/resource.rb
jets-0.8.12 lib/jets/resource.rb
jets-0.8.11 lib/jets/resource.rb
jets-0.8.10 lib/jets/resource.rb
jets-0.8.9 lib/jets/resource.rb
jets-0.8.8 lib/jets/resource.rb
jets-0.8.6 lib/jets/resource.rb
jets-0.8.5 lib/jets/resource.rb