Sha256: 11154e87daedfc430923aa1b24437c74c58eb93fdc91dacfa99a6b813e730378

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require_relative '../resource'

module Convection
  module DSL
    ## Add DSL method to template namespace
    module Template
      def ec2_internet_gateway(name, &block)
        r = Model::Template::Resource::EC2InternetGateway.new(name, self)

        r.instance_exec(&block) if block
        resources[name] = r
      end

      module Resource
        ##
        # Add DSL for VPCGatewayAttachment
        module EC2InternetGateway
          def attach_to_vpc(vpc, &block)
            a = Model::Template::Resource::EC2VPCGatewayAttachment.new("#{ name }VPCAttachment#{ vpc.name }", self)
            a.vpc_id(vpc)
            a.internet_gateway(self)

            a.instance_exec(&block) if block
            @template.resources[a.name] = a
          end
        end
      end
    end
  end

  module Model
    class Template
      class Resource
        ##
        # AWS::EC2::InternetGateway
        ##
        class EC2InternetGateway < Resource
          include Model::Mixin::Taggable
          include DSL::Template::Resource::EC2InternetGateway

          def initialize(*args)
            super
            type 'AWS::EC2::InternetGateway'
          end

          def render(*args)
            super.tap do |resource|
              render_tags(resource)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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