File: add_instance_groups.rb

package info (click to toggle)
ruby-fog-aws 3.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,816 kB
  • sloc: ruby: 68,587; makefile: 6
file content (42 lines) | stat: -rw-r--r-- 1,809 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module Fog
  module AWS
    class EMR
      class Real
        require 'fog/aws/parsers/emr/add_instance_groups'

        # adds an instance group to a running cluster
        # http://docs.amazonwebservices.com/ElasticMapReduce/latest/API/API_AddInstanceGroups.html
        # ==== Parameters
        # * JobFlowId <~String> - Job flow in which to add the instance groups
        # * InstanceGroups<~Array> - Instance Groups to add
        #   * 'BidPrice'<~String> - Bid price for each Amazon EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
        #   * 'InstanceCount'<~Integer> - Target number of instances for the instance group
        #   * 'InstanceRole'<~String> - MASTER | CORE | TASK The role of the instance group in the cluster
        #   * 'InstanceType'<~String> - The Amazon EC2 instance type for all instances in the instance group
        #   * 'MarketType'<~String> - ON_DEMAND | SPOT Market type of the Amazon EC2 instances used to create a cluster node
        #   * 'Name'<~String> - Friendly name given to the instance group.
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        def add_instance_groups(job_flow_id, options={})
          if instance_groups = options.delete('InstanceGroups')
            options.merge!(Fog::AWS.indexed_param('InstanceGroups.member.%d', [*instance_groups]))
          end

          request({
            'Action'  => 'AddInstanceGroups',
            'JobFlowId' => job_flow_id,
            :parser   => Fog::Parsers::AWS::EMR::AddInstanceGroups.new,
          }.merge(options))
        end
      end

      class Mock
        def add_instance_groups(job_flow_id, options={})
          Fog::Mock.not_implemented
        end
      end
    end
  end
end