2011-06-12 21:07:42 +01:00
|
|
|
require 'fog/aws/models/auto_scaling/activity'
|
2011-06-21 22:15:33 +01:00
|
|
|
|
2011-06-12 21:07:42 +01:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class AutoScaling
|
|
|
|
class Activities < Fog::Collection
|
|
|
|
model Fog::AWS::AutoScaling::Activity
|
|
|
|
|
2013-07-29 16:04:44 -07:00
|
|
|
attribute :filters
|
|
|
|
|
|
|
|
# Creates a new scaling policy.
|
|
|
|
def initialize(attributes={})
|
|
|
|
self.filters = attributes
|
|
|
|
super(attributes)
|
|
|
|
end
|
|
|
|
|
|
|
|
def all(filters = filters)
|
2011-06-12 21:07:42 +01:00
|
|
|
data = []
|
|
|
|
next_token = nil
|
2013-07-29 16:04:44 -07:00
|
|
|
self.filters = filters
|
2011-06-12 21:07:42 +01:00
|
|
|
loop do
|
2013-07-29 16:04:44 -07:00
|
|
|
result = service.describe_scaling_activities(filters.merge('NextToken' => next_token)).body['DescribeScalingActivitiesResult']
|
2011-06-12 21:07:42 +01:00
|
|
|
data += result['Activities']
|
|
|
|
next_token = result['NextToken']
|
|
|
|
break if next_token.nil?
|
|
|
|
end
|
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(identity)
|
2012-12-22 23:32:30 +00:00
|
|
|
data = service.describe_scaling_activities('ActivityId' => identity).body['DescribeScalingActivitiesResult']['Activities'].first
|
2011-06-12 21:07:42 +01:00
|
|
|
new(data) unless data.nil?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|