lib/launcher/cli/stack.rb
# This CLI command simulates and outputs various information that would be used to
# create or update an AWS Cloudformation.
This CLI command simulates and outputs various information that would be used to
create or update an AWS Cloudformation.
This CLI command simulates and outputs various information that would be used to create or update an AWS Cloudformation .
def simulate
        stack = Launcher::Stack.new(name, template, discovered) { |message, opts|
          Launcher::Log.send(opts[:type] || :info, message)
        }
        if stack.valid?
          Launcher::Log.ok "Stack would be launched with ID \"#{name}\""
          discovered = stack.filtered_parameters
          unless discovered.empty?
            Launcher::Log.ok "With discovered parameters:"
            rows = []
            discovered.each { |k, v| rows << [k, v] }
            Launcher::Log.ok "\n", Terminal::Table.new(:headings => ["Key", "Value"], :rows => rows)
          else
            Launcher::Log.warn "No discoverable parameters found."
          end
          defaulted = template.defaulted_parameters
          unless defaulted.empty?
            Launcher::Log.ok "With defaulted parameters:"
            rows = []
            defaulted.each { |k, v| rows << [k, v[:Default]] }
            Launcher::Log.ok "\n", Terminal::Table.new(:headings => ["Key", "Value"], :rows => rows)
          else
            Launcher::Log.warn "No defaulted parameters found."
          end
        end
      end
def simulate stack = Launcher :: Stack . new ( name , template , discovered ) { | message , opts | Launcher :: Log . send ( opts [ :type ] || :info , message ) } if stack . valid? Launcher :: Log . ok "Stack would be launched with ID \"#{name}\"" discovered = stack . filtered_parameters unless discovered . empty? Launcher :: Log . ok "With discovered parameters:" rows = [ ] discovered . each { | k , v | rows << [ k , v ] } Launcher :: Log . ok "\n" , Terminal :: Table . new ( :headings => [ "Key" , "Value" ] , :rows => rows ) else Launcher :: Log . warn "No discoverable parameters found." end defaulted = template . defaulted_parameters unless defaulted . empty? Launcher :: Log . ok "With defaulted parameters:" rows = [ ] defaulted . each { | k , v | rows << [ k , v [ :Default ] ] } Launcher :: Log . ok "\n" , Terminal :: Table . new ( :headings => [ "Key" , "Value" ] , :rows => rows ) else Launcher :: Log . warn "No defaulted parameters found." end end end
This CLI command simulates and outputs various information that would be used to
create or update an AWS Cloudformation.
This CLI command simulates and outputs various information that would be used to create or update an AWS Cloudformation .