module Convection::DSL::Template

Template DSL

Add DSL method to template namespace

Constants

CF_MAX_BYTESIZE
CF_MAX_DESCRIPTION_BYTESIZE
CF_MAX_MAPPINGS
CF_MAX_MAPPING_ATTRIBUTES
CF_MAX_MAPPING_ATTRIBUTE_NAME
CF_MAX_MAPPING_NAME
CF_MAX_OUTPUTS
CF_MAX_OUTPUT_NAME_CHARACTERS
CF_MAX_PARAMETERS
CF_MAX_PARAMETER_NAME_CHARACTERS
CF_MAX_PARAMETER_VALUE_BYTESIZE
CF_MAX_RESOURCES
CF_MAX_RESOURCE_NAME

Public Instance Methods

condition(name, &block) click to toggle source
# File lib/convection/model/template.rb, line 97
def condition(name, &block)
  c = Model::Template::Condition.new(name, self)

  c.instance_exec(&block) if block
  conditions[name] = c
end
logs_log_group(name, &block) click to toggle source
# File lib/convection/model/template/resource/aws_logs_loggroup.rb, line 25
def logs_log_group(name, &block)
  r = Model::Template::Resource::LogGroup.new(name, self)

  r.instance_exec(&block) if block
  resources[name] = r
end
mapping(name, &block) click to toggle source
# File lib/convection/model/template.rb, line 90
def mapping(name, &block)
  m = Model::Template::Mapping.new(name, self)

  m.instance_exec(&block) if block
  mappings[name] = m
end
metadata(name = nil, value = nil) click to toggle source

@param name [String] the name of the new metadata configuration to set @param value [Hash] an arbritrary JSON object to set as the

value of the new metadata configuration
# File lib/convection/model/template.rb, line 127
def metadata(name = nil, value = nil)
  return @metadata unless name

  @metadata[name] = Model::Template::Metadata.new(name, value)
end
output(name, &block) click to toggle source
# File lib/convection/model/template.rb, line 117
def output(name, &block)
  o = Model::Template::Output.new(name, self)

  o.instance_exec(&block) if block
  outputs[name] = o
end
parameter(name, &block) click to toggle source
# File lib/convection/model/template.rb, line 83
def parameter(name, &block)
  pa = Model::Template::Parameter.new(name, self)

  pa.instance_exec(&block) if block
  parameters[name] = pa
end
resource(name, &block) click to toggle source
# File lib/convection/model/template.rb, line 104
def resource(name, &block)
  r = Model::Template::Resource.new(name, self)

  r.instance_exec(&block) if block
  predefined_resources = DSL::Template::Resource.resource_dsl_methods.select { |_, resource_class| resource_class.type == r.type }.keys
  if predefined_resources.any?
    dsl_methods = predefined_resources.map { |resource| "##{resource}" }.join(', ')
    warn "WARNING: The resource type #{r.type} is already defined. " \
      "You can use any of the following resource methods instead of manually constructing a resource: #{dsl_methods}"
  end
  resources[name] = r
end