Class: AWS::EMR::InstanceGroupCollection
- Inherits:
-
Object
- Object
- AWS::EMR::InstanceGroupCollection
- Includes:
- Core::Collection::Simple
- Defined in:
- lib/aws/emr/instance_group_collection.rb
Instance Attribute Summary collapse
- #job_flow ⇒ JobFlow readonly
Instance Method Summary collapse
-
#[](instance_group_id) ⇒ InstanceGroup
Returns an instance group with the given ID.
-
#create(role, instance_type, instance_count, options = {}) ⇒ InstanceGroup
(also: #add)
Adds an instance group to the job flow.
Methods included from Core::Collection
#each, #each_batch, #enum, #first, #in_groups_of, #page
Instance Attribute Details
#job_flow ⇒ JobFlow (readonly)
28 29 30 |
# File 'lib/aws/emr/instance_group_collection.rb', line 28 def job_flow @job_flow end |
Instance Method Details
#[](instance_group_id) ⇒ InstanceGroup
Returns an instance group with the given ID.
32 33 34 |
# File 'lib/aws/emr/instance_group_collection.rb', line 32 def [] instance_group_id InstanceGroup.new(job_flow, instance_group_id) end |
#create(role, instance_type, instance_count, options = {}) ⇒ InstanceGroup Also known as: add
Adds an instance group to the job flow.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/aws/emr/instance_group_collection.rb', line 48 def create role, instance_type, instance_count, = {} [:instance_role] = role [:instance_type] = instance_type [:instance_count] = instance_count [:bid_price] = [:bid_price].to_s if [:bid_price] client_opts = {} client_opts[:job_flow_id] = job_flow.job_flow_id client_opts[:instance_groups] = [] resp = client.add_instance_groups(client_opts) self[resp.data[:instance_group_ids].first] end |