Sha256: eebd80417db10edeb533becebdb276137042636904502899c2ebdb1b70bdb003
Contents?: true
Size: 985 Bytes
Versions: 3
Compression:
Stored size: 985 Bytes
Contents
require 'json' module Stackster class StackCreater def initialize(args) @config = args[:config] @entry = args[:entry] @name = args[:name] @template = read_template_from_file args[:template_file] end def create cloud_formation.create :name => @name, :parameters => read_parameters_from_entry, :template => @template end private def cloud_formation @cf ||= AWS::CloudFormation.new :config => @config end def read_template_from_file(template_file) file = File.open template_file file.read end def read_parameters_from_template t = JSON.parse @template t['Parameters'] ? t['Parameters'].keys : [] end def read_parameters_from_entry h = {} attributes = @entry.attributes read_parameters_from_template.each do |p| h[p] = attributes[p] if attributes[p] end h end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
stackster-0.2.2 | lib/stackster/stack/stack_creater.rb |
stackster-0.2.1 | lib/stackster/stack/stack_creater.rb |
stackster-0.2.0 | lib/stackster/stack/stack_creater.rb |