class Roark::AmiCreateWorkflow

Public Class Methods

new(args) click to toggle source
# 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

Public Instance Methods

add_tags() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 50
def add_tags
  @ami.add_tags @tags
end
authorize_account_ids() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 54
def authorize_account_ids
  @ami.authorize_account_ids @account_ids
end
create_ami() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 38
def create_ami
  @ami.create_ami
end
create_instance() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 21
def create_instance
  @ami.create_instance :parameters => @parameters,
                       :template   => @template
end
destroy_instance() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 46
def destroy_instance
  @ami.destroy_instance
end
execute() click to toggle source
# 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() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 30
def stop_instance
  @ami.stop_instance
end
wait_for_ami() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 42
def wait_for_ami
  @ami.wait_for_ami
end
wait_for_instance() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 26
def wait_for_instance
  @ami.wait_for_instance
end
wait_for_instance_to_stop() click to toggle source
# File lib/roark/ami_create_workflow.rb, line 34
def wait_for_instance_to_stop
  @ami.wait_for_instance_to_stop
end