module Aws::AutoScaling::AutoScalingGroupFletsExtension

Public Instance Methods

fleet() click to toggle source
# File lib/aws-sdk-autoscaling/fleets.rb, line 21
def fleet
  fleet_tag = tags.find {|t| t.key =~ /^asgfleet:/ }
  return nil unless fleet_tag

  fleet_name = fleet_tag.key.split(':', 2)[1]
  Fleet.new(fleet_name, client: @client)
end
set_fleet(fleet, role = "member") click to toggle source
# File lib/aws-sdk-autoscaling/fleets.rb, line 29
def set_fleet fleet, role = "member"
  if fleet && self.fleet
    raise ArgumentError, "Group already belongs to a fleet"
  end

  if fleet.nil?
    tags.find {|t| t.key =~ /^asgfleet:/ }.delete
  else
    @client.create_or_update_tags(:tags => [{
      :resource_type => "auto-scaling-group",
      :resource_id => name,
      :key => "asgfleet:#{fleet.is_a?(Fleet) ? fleet.name : fleet}",
      :value => role,
      :propagate_at_launch => false
    }])
  end
end