class Commands::AbstractInstanceGroupCommand

Attributes

bid_price[RW]
instance_count[RW]
instance_group_id[RW]
instance_group_name[RW]
instance_role[RW]
instance_type[RW]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Commands::Command::new
# File lib/commands.rb, line 1094
def initialize(*args)
  super(*args)
  if @arg =~ /^ig-/ then
    @instance_group_id = @arg
  else
    @instance_role = @arg.upcase
  end
end

Public Instance Methods

default_instance_group_name() click to toggle source
# File lib/commands.rb, line 1103
def default_instance_group_name
  get_field(:instance_role).downcase.capitalize + " Instance Group"
end
instance_group() click to toggle source
# File lib/commands.rb, line 1107
def instance_group
  ig =  {
    "Name" => get_field(:instance_group_name),
    "InstanceRole" => get_field(:instance_role),
    "InstanceCount" => get_field(:instance_count),
    "InstanceType"  => get_field(:instance_type)
  }
  if get_field(:bid_price, nil) != nil
    ig["BidPrice"] = get_field(:bid_price)
    ig["Market"] = "SPOT"
  else
    ig["Market"] = "ON_DEMAND"
  end
  return ig
end
require_singleton_array(arr, msg) click to toggle source
# File lib/commands.rb, line 1123
def require_singleton_array(arr, msg)
  if arr.size != 1 then
    raise RuntimeError, "Expected to find one " + msg + " but found #{arr.size}."
  end
end