class Leeroy::Types::Instance

Public Class Methods

new(*args, &block) click to toggle source
Calls superclass method
# File lib/leeroy/types/instance.rb, line 30
def initialize(*args, &block)
  self.aws_params = [
    :iam_instance_profile,
    :image_id,
    :instance_type,
    :key_name,
    :max_count,
    :min_count,
    :security_group_ids,
    :subnet_id,
    :user_data,
  ]

  self.dump_properties = self.aws_params

  super
end

Public Instance Methods

run_params() click to toggle source
# File lib/leeroy/types/instance.rb, line 48
def run_params
  begin
    params_hash = Leeroy::Types::Mash.new

    self.aws_params.each {|param| params_hash.store(param.to_s, self.fetch(param.to_s))}

    # UserData is special!

    params_hash.store('user_data', self.fetch('user_data').encoded_for_ec2)

    params_hash

  rescue StandardError => e
    raise e
  end
end