Class: Roark::AmiCreateWorkflow
- Inherits:
-
Object
- Object
- Roark::AmiCreateWorkflow
- Defined in:
- lib/roark/ami_create_workflow.rb
Instance Method Summary collapse
- #add_tags ⇒ Object
- #authorize_account_ids ⇒ Object
- #create_ami ⇒ Object
- #create_instance ⇒ Object
- #destroy_instance ⇒ Object
- #execute ⇒ Object
-
#initialize(args) ⇒ AmiCreateWorkflow
constructor
A new instance of AmiCreateWorkflow.
- #stop_instance ⇒ Object
- #wait_for_ami ⇒ Object
- #wait_for_instance ⇒ Object
- #wait_for_instance_to_stop ⇒ Object
Constructor Details
#initialize(args) ⇒ AmiCreateWorkflow
Returns a new instance of AmiCreateWorkflow.
4 5 6 7 8 9 10 |
# File 'lib/roark/ami_create_workflow.rb', line 4 def initialize(args) @account_ids = Array(args[:account_ids]) @ami = args[:ami] @tags = args.fetch :tags, {} @parameters = args[:parameters] @template = args[:template] end |
Instance Method Details
#add_tags ⇒ Object
50 51 52 |
# File 'lib/roark/ami_create_workflow.rb', line 50 def @ami. @tags end |
#authorize_account_ids ⇒ Object
54 55 56 |
# File 'lib/roark/ami_create_workflow.rb', line 54 def @ami. @account_ids end |
#create_ami ⇒ Object
38 39 40 |
# File 'lib/roark/ami_create_workflow.rb', line 38 def create_ami @ami.create_ami end |
#create_instance ⇒ Object
21 22 23 24 |
# File 'lib/roark/ami_create_workflow.rb', line 21 def create_instance @ami.create_instance :parameters => @parameters, :template => @template end |
#destroy_instance ⇒ Object
46 47 48 |
# File 'lib/roark/ami_create_workflow.rb', line 46 def destroy_instance @ami.destroy_instance end |
#execute ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/roark/ami_create_workflow.rb', line 12 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_instance ⇒ Object
30 31 32 |
# File 'lib/roark/ami_create_workflow.rb', line 30 def stop_instance @ami.stop_instance end |
#wait_for_ami ⇒ Object
42 43 44 |
# File 'lib/roark/ami_create_workflow.rb', line 42 def wait_for_ami @ami.wait_for_ami end |
#wait_for_instance ⇒ Object
26 27 28 |
# File 'lib/roark/ami_create_workflow.rb', line 26 def wait_for_instance @ami.wait_for_instance end |
#wait_for_instance_to_stop ⇒ Object
34 35 36 |
# File 'lib/roark/ami_create_workflow.rb', line 34 def wait_for_instance_to_stop @ami.wait_for_instance_to_stop end |