Class: Commands::AbstractInstanceGroupCommand

Inherits:
Command show all
Defined in:
lib/commands.rb

Instance Attribute Summary collapse

Attributes inherited from Command

#arg, #commands, #description, #logger, #name

Instance Method Summary collapse

Methods inherited from Command

#enact, #get_field, #has_value, #have, #option, #require, #require_single_jobflow, #resolve, #validate

Constructor Details

#initialize(*args) ⇒ AbstractInstanceGroupCommand

Returns a new instance of AbstractInstanceGroupCommand.



1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/commands.rb', line 1056

def initialize(*args)
  super(*args)
  if @arg =~ /^ig-/ then
    @instance_group_id = @arg
  else
    @instance_role = @arg.upcase
  end
end

Instance Attribute Details

#instance_countObject

Returns the value of attribute instance_count.



1053
1054
1055
# File 'lib/commands.rb', line 1053

def instance_count
  @instance_count
end

#instance_group_idObject

Returns the value of attribute instance_group_id.



1053
1054
1055
# File 'lib/commands.rb', line 1053

def instance_group_id
  @instance_group_id
end

#instance_group_nameObject

Returns the value of attribute instance_group_name.



1053
1054
1055
# File 'lib/commands.rb', line 1053

def instance_group_name
  @instance_group_name
end

#instance_roleObject

Returns the value of attribute instance_role.



1053
1054
1055
# File 'lib/commands.rb', line 1053

def instance_role
  @instance_role
end

#instance_typeObject

Returns the value of attribute instance_type.



1053
1054
1055
# File 'lib/commands.rb', line 1053

def instance_type
  @instance_type
end

Instance Method Details

#default_instance_group_nameObject



1065
1066
1067
# File 'lib/commands.rb', line 1065

def default_instance_group_name
  get_field(:instance_role).downcase.capitalize + " Instance Group"
end

#instance_groupObject



1069
1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/commands.rb', line 1069

def instance_group
  return {
    "Name" => get_field(:instance_group_name),
    "Market" => get_field(:instance_group_market, "ON_DEMAND"),
    "InstanceRole" => get_field(:instance_role),
    "InstanceCount" => get_field(:instance_count),
    "InstanceType"  => get_field(:instance_type)
  }
end

#require_singleton_array(arr, msg) ⇒ Object



1079
1080
1081
1082
1083
# File 'lib/commands.rb', line 1079

def require_singleton_array(arr, msg)
  if arr.size != 1 then
    raise RuntimeError, "Expected to find one " + msg + " but found #{arr.size}."
  end
end