Sha256: 84901e5016c482b9f36a40d481d8a5b0666b598dc0bf9d9377a70ad67b82fa2d

Contents?: true

Size: 887 Bytes

Versions: 12

Compression:

Stored size: 887 Bytes

Contents

require 'yaml'
require 'erb'
require 'cfnlego/cloudformation'
require 'cfnlego/resource'
require 'net/http'
require 'uri'

# Cfnlego
module Cfnlego
  def self.Resources
    content = fetch_resource_content
    supported_resources = JSON.parse(content)
    resources = []
    supported_resources['ResourceTypes'].each_key do |resource|
      resources << resource
    end
    resources
  end

  def self.fetch_resource_content
    File.read(CfnDsl.specification_file)
  end

  def self.run(options)
    # Constructure Resources
    resources = []
    options[:resources].each do |r|
      /(.*),(.*)/.match(r) do |m|
        type = m[1]
        name = m[2]
        resources << Cfnlego::Resource.new(type, name)
      end
    end

    begin
      return Cfnlego::CloudFormation.new(resources).render
    rescue RuntimeError => e
      warn "Error: #{e.message}"
    end
    nil
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cfndsl-0.16.13 lib/cfnlego.rb
cfndsl-0.16.12 lib/cfnlego.rb
cfndsl-0.16.11 lib/cfnlego.rb
cfndsl-0.16.10 lib/cfnlego.rb
cfndsl-0.16.9 lib/cfnlego.rb
cfndsl-0.16.8 lib/cfnlego.rb
cfndsl-0.16.7 lib/cfnlego.rb
cfndsl-0.16.6 lib/cfnlego.rb
cfndsl-0.16.5 lib/cfnlego.rb
cfndsl-0.16.3 lib/cfnlego.rb
cfndsl-0.16.2 lib/cfnlego.rb
cfndsl-0.16.1 lib/cfnlego.rb