Sha256: 5591478d6da1599bf4f637c5e5c06b8ae914f435acfb746778a93a6181eb4d9b

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

require_relative '../../dsl/intrinsic_functions'
require_relative '../mixin/cidr_block'
require_relative '../mixin/conditional'
require_relative '../mixin/taggable'

module Convection
  module Model
    class Template
      ##
      # Resource
      ##
      class Resource
        extend DSL::Helpers
        include DSL::IntrinsicFunctions
        include Model::Mixin::Conditional

        attribute :type
        attr_reader :name
        attr_reader :properties

        def initialize(name, template)
          @name = name
          @template = template

          @type = ''
          @properties = {}
        end

        def property(key, value)
          properties[key] = value.is_a?(Model::Template::Resource) ? value.reference : value
        end

        def reference
          {
            'Ref' => name
          }
        end

        def render
          {
            'Type' => type,
            'Properties' => properties
          }.tap do |resource|
            render_condition(resource)
          end
        end
      end
    end
  end
end

require_relative 'resource/aws_ec2_instance'
require_relative 'resource/aws_ec2_internet_gateway'
require_relative 'resource/aws_ec2_route'
require_relative 'resource/aws_ec2_route_table'
require_relative 'resource/aws_ec2_security_group'
require_relative 'resource/aws_ec2_subnet'
require_relative 'resource/aws_ec2_subnet_route_table_association'
require_relative 'resource/aws_ec2_vpc'
require_relative 'resource/aws_ec2_vpc_gateway_attachment'
require_relative 'resource/aws_s3_bucket'
require_relative 'resource/aws_s3_bucket_policy'
require_relative 'resource/aws_iam_role'
require_relative 'resource/aws_iam_policy'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convection-0.0.1 lib/convection/model/template/resource.rb