Class: Aws::AutoScaling::FleetCollection
- Inherits:
-
Object
- Object
- Aws::AutoScaling::FleetCollection
- Includes:
- Enumerable
- Defined in:
- lib/aws-sdk-autoscaling/fleet_collection.rb
Instance Method Summary collapse
-
#create(name, template_group) ⇒ Fleet
Create an ASG Fleet.
- #each ⇒ Object
-
#initialize(opts) ⇒ FleetCollection
constructor
A new instance of FleetCollection.
Constructor Details
#initialize(opts) ⇒ FleetCollection
Returns a new instance of FleetCollection.
6 7 8 |
# File 'lib/aws-sdk-autoscaling/fleet_collection.rb', line 6 def initialize(opts) @resource = opts.delete(:resource) end |
Instance Method Details
#create(name, template_group) ⇒ Fleet
Create an ASG Fleet.
To create a Fleet, you must supply an already-constructed Auto Scaling group to be used as the template for new groups added to the fleet.
fleet = auto_scaling.fleets.create('fleet-name',
auto_scaling.groups['my-asg-group'])
27 28 29 30 31 32 33 |
# File 'lib/aws-sdk-autoscaling/fleet_collection.rb', line 27 def create name, template_group raise ArgumentError, "Fleet #{name} already exists" if @resource.fleet(name).exists? raise ArgumentError, "Group is already in a fleet" if template_group.fleet template_group.set_fleet(name, "template") @resource.fleet(name) end |
#each ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/aws-sdk-autoscaling/fleet_collection.rb', line 35 def each yielded_fleets = [] @resource..each do |tag| if tag.key =~ /^asgfleet:/ name = tag.key.split(':', 2)[1] next if yielded_fleets.include? name yielded_fleets << name yield @resource.fleet(name) end end end |