Class: Leeroy::Types::Instance

Inherits:
Dash
  • Object
show all
Includes:
Helpers::Dumpable, Helpers::Logging
Defined in:
lib/leeroy/types/instance.rb

Constant Summary

Constants included from Helpers::Logging

Helpers::Logging::TRACE_FORMAT, Helpers::Logging::TRACE_LEVELS, Helpers::Logging::TRUNCATE_THRESHOLD

Instance Attribute Summary

Attributes included from Helpers::Dumpable

#dump_properties

Instance Method Summary collapse

Methods included from Helpers::Logging

#logger

Methods included from Helpers::Dumpable

#dump, #dumper

Methods inherited from Dash

#dumper

Constructor Details

#initialize(*args, &block) ⇒ Instance

Returns a new instance of Instance.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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

Instance Method Details

#run_paramsObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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