Class: Roark::AmiCreateWorkflow

Inherits:
Object
  • Object
show all
Defined in:
lib/roark/ami_create_workflow.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ AmiCreateWorkflow

Returns a new instance of AmiCreateWorkflow.



4
5
6
7
8
9
10
11
# File 'lib/roark/ami_create_workflow.rb', line 4

def initialize(args)
  @account_ids = args[:account_ids]
  @ami         = args[:ami]
  @tags        = args[:tags]
  @parameters  = args[:parameters]
  @template    = args[:template]
  @logger      = Roark.logger
end

Instance Method Details

#add_tagsObject



51
52
53
# File 'lib/roark/ami_create_workflow.rb', line 51

def add_tags
  @ami.add_tags @tags
end

#authorize_account_idsObject



55
56
57
# File 'lib/roark/ami_create_workflow.rb', line 55

def 
  @ami. @account_ids
end

#create_amiObject



39
40
41
# File 'lib/roark/ami_create_workflow.rb', line 39

def create_ami
  @ami.create_ami
end

#create_instanceObject



22
23
24
25
# File 'lib/roark/ami_create_workflow.rb', line 22

def create_instance
  @ami.create_instance :parameters => @parameters,
                       :template   => @template
end

#destroy_instanceObject



47
48
49
# File 'lib/roark/ami_create_workflow.rb', line 47

def destroy_instance
  @ami.destroy_instance
end

#executeObject



13
14
15
16
17
18
19
20
# File 'lib/roark/ami_create_workflow.rb', line 13

def execute
  %w(create_instance wait_for_instance stop_instance wait_for_instance_to_stop
     create_ami wait_for_ami destroy_instance add_tags authorize_account_ids).each do |m|
    response = self.send m.to_sym
    return response unless response.success?
  end
  Response.new :code => 0, :message => "AMI create workflow completed succesfully."
end

#stop_instanceObject



31
32
33
# File 'lib/roark/ami_create_workflow.rb', line 31

def stop_instance
  @ami.stop_instance
end

#wait_for_amiObject



43
44
45
# File 'lib/roark/ami_create_workflow.rb', line 43

def wait_for_ami
  @ami.wait_for_ami
end

#wait_for_instanceObject



27
28
29
# File 'lib/roark/ami_create_workflow.rb', line 27

def wait_for_instance
  @ami.wait_for_instance
end

#wait_for_instance_to_stopObject



35
36
37
# File 'lib/roark/ami_create_workflow.rb', line 35

def wait_for_instance_to_stop
  @ami.wait_for_instance_to_stop
end