Class: SimpleDeploy::Stack

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Stack

Returns a new instance of Stack.



9
10
11
12
13
14
# File 'lib/simple_deploy/stack.rb', line 9

def initialize(args)
  @environment = args[:environment]
  @name = args[:name]
  @config = Config.new
  @config.logger = SimpleDeployLogger.new
end

Class Method Details

.list(args) ⇒ Object



16
17
18
# File 'lib/simple_deploy/stack.rb', line 16

def self.list(args)
  StackLister.new(:config => args[:config]).all
end

Instance Method Details

#attributesObject



67
68
69
# File 'lib/simple_deploy/stack.rb', line 67

def attributes
  stack.attributes 
end

#create(args) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/simple_deploy/stack.rb', line 20

def create(args)
  saf = StackAttributeFormater.new(:attributes  => args[:attributes],
                                   :config      => @config,
                                   :environment => @environment)
  stack.create :attributes => saf.updated_attributes,
               :template => args[:template]
end

#deployObject



35
36
37
38
39
40
41
# File 'lib/simple_deploy/stack.rb', line 35

def deploy
  deployment = Deployment.new :config => @config,
                              :environment => @environment,
                              :instances => instances,
                              :attributes => attributes
  deployment.execute
end

#destroyObject



43
44
45
# File 'lib/simple_deploy/stack.rb', line 43

def destroy
  stack.destroy
end

#eventsObject



47
48
49
# File 'lib/simple_deploy/stack.rb', line 47

def events
  stack.events
end

#instancesObject



59
60
61
# File 'lib/simple_deploy/stack.rb', line 59

def instances
  stack.instances_private_ip_addresses
end

#outputsObject



51
52
53
# File 'lib/simple_deploy/stack.rb', line 51

def outputs
  stack.outputs
end

#resourcesObject



55
56
57
# File 'lib/simple_deploy/stack.rb', line 55

def resources
  stack.resources
end

#statusObject



63
64
65
# File 'lib/simple_deploy/stack.rb', line 63

def status
  stack.status
end

#templateObject



71
72
73
# File 'lib/simple_deploy/stack.rb', line 71

def template
  JSON.parse stack.template
end

#update(args) ⇒ Object



28
29
30
31
32
33
# File 'lib/simple_deploy/stack.rb', line 28

def update(args)
  saf = StackAttributeFormater.new(:attributes  => args[:attributes],
                                   :config      => @config,
                                   :environment => @environment)
  stack.update :attributes => saf.updated_attributes
end