Class: AWS::AutoScaling::GroupCollection
- Inherits:
-
Object
- Object
- AWS::AutoScaling::GroupCollection
- Includes:
- Core::Collection::WithLimitAndNextToken
- Defined in:
- lib/aws/auto_scaling/group_collection.rb
Instance Method Summary collapse
- #[](name) ⇒ Group
-
#create(name, options = {}) ⇒ Group
Creates an Auto Scaling Group.
Methods included from Core::Collection
#each, #each_batch, #enum, #first, #in_groups_of, #page
Instance Method Details
#[](name) ⇒ Group
66 67 68 |
# File 'lib/aws/auto_scaling/group_collection.rb', line 66 def [] name Group.new(name, :config => config) end |
#create(name, options = {}) ⇒ Group
Creates an Auto Scaling Group.
group = auto_scaling.groups.create('group-name',
:launch_configuration => 'launch-config-name',
:availability_zones => %(us-east-1a us-east-1b),
:min_size => 1,
:max_size => 4)
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/aws/auto_scaling/group_collection.rb', line 43 def create name, = {} unless [:launch_configuration] raise ArgumentError, 'missing required option :launch_configuration' end group_opts = () group_opts[:auto_scaling_group_name] = name if balancers = [:load_balancers] group_opts[:load_balancer_names] = balancers.collect do |balancer| balancer.is_a?(ELB::LoadBalancer) ? balancer.name : balancer end end client.create_auto_scaling_group(group_opts) self[name] end |