class ActiveAws::CloudFormation::Template
Constants
- DEFAULT_AWS_TEMPLATE_FORMAT_VERSION
- PropertyDefinition
Attributes
aws_template_format_version[R]
description[RW]
outputs[R]
resources[R]
Public Class Methods
new(params = {}, &block)
click to toggle source
Calls superclass method
ActiveAws::ParameterizedInitializer::new
# File lib/active_aws/cloud_formation/template.rb, line 29 def initialize(params = {}, &block) super DSL.new(self).instance_eval(&block) if block_given? end
Public Instance Methods
mappings(&block)
click to toggle source
# File lib/active_aws/cloud_formation/template.rb, line 40 def mappings(&block) @mappings ||= Mappings.new @mappings.instance_eval(&block) if block_given? @mappings end
parameters(&block)
click to toggle source
# File lib/active_aws/cloud_formation/template.rb, line 34 def parameters(&block) @parameters ||= Parameter::Collection.new @parameters.instance_eval(&block) if block_given? @parameters end
to_h()
click to toggle source
# File lib/active_aws/cloud_formation/template.rb, line 71 def to_h {'AWSTemplateFormatVersion' => DEFAULT_AWS_TEMPLATE_FORMAT_VERSION}.tap {|h| h['Description'] = @description unless @description.nil? [:parameters, :mappings, :resources].each {|sym| v = instance_variable_get("@#{sym}") h[sym.to_s.capitalize] = v.to_h unless v.nil? || v.empty? } } end
to_json(*args)
click to toggle source
# File lib/active_aws/cloud_formation/template.rb, line 81 def to_json(*args) pretty = args.include?(:pretty) pretty ? JSON.pretty_generate(to_h) : to_h.to_json end