require 'stackster/stack/stack_creater' require 'stackster/stack/stack_updater' require 'stackster/stack/stack_destroyer' require 'stackster/stack/stack_reader' require 'stackster/stack/stack_formater' require 'stackster/stack/stack_lister' module Stackster class Stack def initialize(args) @config = Config.new :config => args[:config] @name = args[:name] @entry = Entry.new :name => @name, :config => @config end def self.list(args) @config = Config.new :config => args[:config] StackLister.new(:config => @config).all end def create(args) @template_file = args[:template] @entry.set_attributes args[:attributes] @entry.save stack_creater.create end def update(args) @template_body = template @entry.set_attributes args[:attributes] @entry.save stack_updater.update end def destroy stack_destroyer.destroy @entry.delete_attributes end def attributes stack_formater.attributes end def display stack_formater.display end def show stack_reader.show end def outputs stack_reader.outputs end def status stack_reader.status end def events stack_reader.events end def instances stack_reader.instances end def instances_public_ip_addresses stack_formater.instances_public_ip_addresses end def resources stack_reader.resources end def template stack_reader.template end private def stack_creater @stack_creater ||= StackCreater.new :name => @name, :entry => @entry, :template_file => @template_file, :config => @config end def stack_updater @stack_updater ||= StackUpdater.new :name => @name, :entry => @entry, :template_body => @template_body, :config => @config end def stack_destroyer @stack_destroyer ||= StackDestroyer.new :name => @name, :config => @config end def stack_reader @stack_reader ||= StackReader.new :name => @name, :config => @config end def stack_formater @stack_formater ||= StackFormater.new :name => @name, :config => @config end end end