Class: Jets::Resource

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/jets/resource.rb,
lib/jets/resource/s3.rb,
lib/jets/resource/base.rb,
lib/jets/resource/function.rb,
lib/jets/resource/replacer.rb,
lib/jets/resource/permission.rb

Defined Under Namespace

Modules: ApiGateway, ChildStack, Iam Classes: Base, Function, Permission, Replacer, S3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition, replacements = {}) ⇒ Resource

Returns a new instance of Resource.



14
15
16
17
# File 'lib/jets/resource.rb', line 14

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

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



13
14
15
# File 'lib/jets/resource.rb', line 13

def definition
  @definition
end

#replacementsObject (readonly)

Returns the value of attribute replacements.



13
14
15
# File 'lib/jets/resource.rb', line 13

def replacements
  @replacements
end

Instance Method Details

#attributesObject



34
35
36
37
38
# File 'lib/jets/resource.rb', line 34

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

#logical_idObject



19
20
21
22
23
24
# File 'lib/jets/resource.rb', line 19

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

#outputsObject



44
45
46
# File 'lib/jets/resource.rb', line 44

def outputs
  {}
end

#parametersObject



40
41
42
# File 'lib/jets/resource.rb', line 40

def parameters
  {}
end

#permissionObject



53
54
55
# File 'lib/jets/resource.rb', line 53

def permission
  Permission.new(replacements, self)
end

#propertiesObject



30
31
32
# File 'lib/jets/resource.rb', line 30

def properties
  attributes['Properties']
end

#replacerObject



48
49
50
# File 'lib/jets/resource.rb', line 48

def replacer
  Replacer.new(replacements)
end

#typeObject



26
27
28
# File 'lib/jets/resource.rb', line 26

def type
  attributes['Type']
end