Class: Commands::AbstractInstanceGroupCommand
- Defined in:
- lib/commands.rb
Direct Known Subclasses
AddInstanceGroupCommand, CreateInstanceGroupCommand, ModifyInstanceGroupCommand, UnarrestInstanceGroupCommand
Instance Attribute Summary collapse
-
#bid_price ⇒ Object
Returns the value of attribute bid_price.
-
#instance_count ⇒ Object
Returns the value of attribute instance_count.
-
#instance_group_id ⇒ Object
Returns the value of attribute instance_group_id.
-
#instance_group_name ⇒ Object
Returns the value of attribute instance_group_name.
-
#instance_role ⇒ Object
Returns the value of attribute instance_role.
-
#instance_type ⇒ Object
Returns the value of attribute instance_type.
Attributes inherited from Command
#arg, #commands, #description, #logger, #name
Instance Method Summary collapse
- #default_instance_group_name ⇒ Object
-
#initialize(*args) ⇒ AbstractInstanceGroupCommand
constructor
A new instance of AbstractInstanceGroupCommand.
- #instance_group ⇒ Object
- #require_singleton_array(arr, msg) ⇒ Object
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.
1094 1095 1096 1097 1098 1099 1100 1101 |
# 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 |
Instance Attribute Details
#bid_price ⇒ Object
Returns the value of attribute bid_price.
1091 1092 1093 |
# File 'lib/commands.rb', line 1091 def bid_price @bid_price end |
#instance_count ⇒ Object
Returns the value of attribute instance_count.
1091 1092 1093 |
# File 'lib/commands.rb', line 1091 def instance_count @instance_count end |
#instance_group_id ⇒ Object
Returns the value of attribute instance_group_id.
1091 1092 1093 |
# File 'lib/commands.rb', line 1091 def instance_group_id @instance_group_id end |
#instance_group_name ⇒ Object
Returns the value of attribute instance_group_name.
1091 1092 1093 |
# File 'lib/commands.rb', line 1091 def instance_group_name @instance_group_name end |
#instance_role ⇒ Object
Returns the value of attribute instance_role.
1091 1092 1093 |
# File 'lib/commands.rb', line 1091 def instance_role @instance_role end |
#instance_type ⇒ Object
Returns the value of attribute instance_type.
1091 1092 1093 |
# File 'lib/commands.rb', line 1091 def instance_type @instance_type end |
Instance Method Details
#default_instance_group_name ⇒ Object
1103 1104 1105 |
# File 'lib/commands.rb', line 1103 def default_instance_group_name get_field(:instance_role).downcase.capitalize + " Instance Group" end |
#instance_group ⇒ Object
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 |
# 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) ⇒ Object
1123 1124 1125 1126 1127 |
# 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 |