Class: Stackster::Stack

Inherits:
Object
  • Object
show all
Defined in:
lib/stackster/stack.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Stack

Returns a new instance of Stack.



12
13
14
15
16
17
18
# File 'lib/stackster/stack.rb', line 12

def initialize(args)
  @name = args[:name]
  @config = Config.new :config => args[:config],
                       :logger => args[:logger] ||= StacksterLogger.new
  @entry = Entry.new :name   => @name,
                     :config => @config
end

Instance Method Details

#attributesObject



49
50
51
# File 'lib/stackster/stack.rb', line 49

def attributes
  stack_reader.attributes
end

#create(args) ⇒ Object

ToDo - maybe in stack creater Rescure stack creation errors and verify entry is not saved



22
23
24
25
26
27
# File 'lib/stackster/stack.rb', line 22

def create(args)
  @template_file = args[:template]
  @entry.set_attributes args[:attributes]
  stack_creater.create
  @entry.save
end

#destroyObject

To do - maybe in stack destroyer Rescue stack creation exception and only delete on success



40
41
42
43
# File 'lib/stackster/stack.rb', line 40

def destroy
  stack_destroyer.destroy
  @entry.delete_attributes
end

#displayObject



45
46
47
# File 'lib/stackster/stack.rb', line 45

def display
  stack_formater.display
end

#events(limit = 3) ⇒ Object



61
62
63
# File 'lib/stackster/stack.rb', line 61

def events(limit=3)
  stack_reader.events limit
end

#instancesObject



65
66
67
# File 'lib/stackster/stack.rb', line 65

def instances
  stack_reader.instances
end

#outputsObject



53
54
55
# File 'lib/stackster/stack.rb', line 53

def outputs
  stack_reader.outputs
end

#parametersObject



77
78
79
# File 'lib/stackster/stack.rb', line 77

def parameters
  stack_reader.parameters
end

#resourcesObject



69
70
71
# File 'lib/stackster/stack.rb', line 69

def resources
  stack_reader.resources
end

#statusObject



57
58
59
# File 'lib/stackster/stack.rb', line 57

def status
  stack_reader.status
end

#templateObject



73
74
75
# File 'lib/stackster/stack.rb', line 73

def template
  stack_reader.template
end

#update(args) ⇒ Object

To Do - maybe in stack udpater Rescure stack creation errors and verify entry is not saved



31
32
33
34
35
36
# File 'lib/stackster/stack.rb', line 31

def update(args)
  @template_body = template
  @entry.set_attributes args[:attributes]
  stack_updater.update_stack_if_parameters_changed args[:attributes]
  @entry.save
end

#wait_for_stableObject



81
82
83
# File 'lib/stackster/stack.rb', line 81

def wait_for_stable
  stack_status.wait_for_stable
end